I am on MacOSX, using the iTerm and I'm very new at all of this. I am trying to prepare for installing bioinformatics programs, so I made new directories for "Scripts" and "Programs" and wanted to add them to the PATH.

This is what I did:

nano .bash_profile
export PATH= "$PATH:$HOME/Scripts"
PATH= "$PATH:$HOME/Programs"
source .bash_profile

it returned:

-bash: export: `/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/Tori/Scripts': not a valid identifier

I tried re-entering the profile using nano and it said -bash: nano: command not found so I closed out that window, reopened a new session, and it came up with the same "not a valid identifier" message and now won't recognize any commands.

What did I mess up and how do I fix it?

closed as off-topic by jasonwryan, Michael Homer, Anthon, slm Mar 10 '15 at 1:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – jasonwryan, Michael Homer, Anthon, slm
If this question can be reworded to fit the rules in the help center, please edit the question.

  • You can't have spaces between the PATH= and the "$PATH:..." – jasonwryan Mar 9 '15 at 20:56

This will fix the issue:

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/Tori/Scripts

The root cause was the extra space after the =.

Obviously, you'll need to edit your .bash_profile afterwards and remove these extra spaces.

  • 1
    That will fix the issue short-term. The Asker will still need to edit .bash_profile and remove the space after the PATH=. (I know you know this, but the Asker might not.) – roaima Mar 9 '15 at 21:51

Not having a Mac here, try calling /usr/bin/nano or /bin/nano instead of plain nano. As you probably know, all directories in your PATH are searched for binaries, and having managed to garble it, it will not find your nano unless you tell it where exactly to look.

As remarked by @jasonwryan, those spaces after the = look very suspicious, those probably shouldn't be there.

(For future reference, since changes in your profile only become active in new windows, it's a good idea to try if everything works in a new terminal window, leaving the old one open.)

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