Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

From my bash shell (latest version of Lion) if I issue the command...

source ~/sh/

The script will run and the functionality it provides is available. However I don't want to manually run this script so I have tried to put it into my ~/.bash_profile (the above command is the only thing in the file).

If I quit Terminal and then restart it, the ~/.bash_profile runs, but it reports...

: command not found

How can I get the commands contained in this script to run when the Terminal is opened? I know the correct .bash_profile is being run, because I can modify the file with some other commands and those don't work either, but the point being is I can see the output change when I modify the contents of the file and restart the shell. So it is picking up the right ~ user directory (I am the only account on the machine).

share|improve this question
up vote 4 down vote accepted

Does your .bash_profile have DOS-style line endings? Strange error messages like that often are "corrupted" by a \r character.

share|improve this answer
Thanks, that was it! I think I originally edited this file from the Windows side, and was subsequently editing from the Mac side, but there must have been some leftover control characters. – bigwavesoftware Jun 11 '12 at 23:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.