Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

When I start my Terminal I get this error. I have no clue how to fix that and where it comes from.

Last login: Fri Nov 30 21:46:06 on ttys000
-bash: export: `/usr/local/bin': not a valid identifier
share|improve this question

Most likely one of the 'export' command in your .bashrc or .bash_profile is mis-configured.

Open up your favorite text editor and view the file(s) in your home directory called .bashrc and .bash_profile.

Look for any lines that begin with


one of the lines should be

export PATH='/usr/local/bin'

there might be spaces between PATH and the first '

export PATH = '/usr/local/bin'  #<----WRONG remove spaces

if not, copy the contents here and let's have a look.

An alternative if you can't find it is to grep through your home dir or /etc:

grep -l -E '/usr/local/bin' .*

make sure you use single quotes to escape the forward slash. then look at the files it lists for the mis-typed export.

share|improve this answer
Thank you for your answer! I already checked both files and they were empty (not existed). If I create a ~./bash_profile file with "export PATH='/usr/local/bin'" as content, the error is still there. weird :/ – nohayeye Nov 30 '12 at 21:03
@nohayeye Those tend to require a reboot, or at least a logout/in to take effect. Did you try that? – nerdwaller Nov 30 '12 at 21:06
It also might be export $PATH somewhere - the dollar sign does not belong there. – choroba Nov 30 '12 at 21:08
how about ~/.bash_login, ~/.profile. also how about /etc/profile. – Johnnie Nov 30 '12 at 21:08
just modified the answer to use grep to find the file. – Johnnie Nov 30 '12 at 21:20

OSX has used the path locations in a few files over the 10.6/7/8:

~/.profile     #local user
/etc/profile   #system wide defaults for ^
/etc/paths     #<---This is probably the one you want to check in.

Check all of those for the path's, as @choroba said above the $ is only for the end of the line, so similar to: export PATH=/opt/local/bin:/usr/sbin:$PATH

share|improve this answer
That's how they look like: No $PATH //EDIT: Sorry wrong screenshot. – nohayeye Nov 30 '12 at 21:50
@nohayeye Odd. Do command line tools work (outside of vi/m as it appears above)? I like where John was going, but I would take it further. Something like for i in `find / -maxdepth 3 -iname "*profile*"`; do grep -i "*path*" ${i}; done I know that is how it works on linux, so it should work. Though, it may be a long search... – nerdwaller Nov 30 '12 at 21:59
I found another topic where someone posted his /etc/paths and /etc/profile. (…) I edited my /etc/paths but the "-bash: export: `/usr/local/bin': not a valid identifier" is still there. All command line tools are working. Weeeeird! – nohayeye Nov 30 '12 at 22:03
Did you reboot after update? – nerdwaller Nov 30 '12 at 22:03
I found it! There was a strange $PATH line in "/etc/bashrc". I deleted it, now everything is working fine. Thanks you all for your help! :) – nohayeye Nov 30 '12 at 22:05

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.