I recently upgraded my osx to os x el capitan. I noticed that subl
command was missing so I tried adding the path to my bash_profile. It didn’t work out so I removed it and then do a source ~/.bash_profile
and now all of my bash commands are gone.
Here is my bash_profile file
export $PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin ## # Your previous /Users/judyngai/.bash_profile file was backed up as /Users/judyngai/.bash_profile.macports-saved_2013-06-27_at_16:30:58 ## # MacPorts Installer addition on 2013-06-27_at_16:30:58: adding an appropriate PATH variable for use with MacPorts. export PATH=/opt/local/bin:/opt/local/sbin:$PATH # Finished adapting your PATH environment variable for use with MacPorts. export PATH=/usr/local/sbin:$path export PATH=/usr/local/bin:$PATH export PATH="$HOME/.rbenv/bin:$PATH" eval "$(rbenv init -)" :q!
and when I do export $PATH
I am getting this
31-34-238:bin judyngai$ export $PATH
-bash: export: `/usr/local/bin:/usr/local/sbin:': not a valid identifier
I cd into all of the directories that its getting searched through /usr/local/bin
, /bin
, /usr/local/bin
etc. and saw all of the commands in there.
and this
31-34-238:~ judyngai$ source ~/.bash_profile -bash: export: `/Users/judyngai/.rbenv/bin:/usr/local/bin:/usr/local/sbin:=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin': not a valid identifier env: bash: No such file or directory -bash: :q!: command not found
I actually think my bash_profile is fine so what is wrong? Rbenv and macport both look fine.
Advertisement
Answer
This line is destroying your path: export PATH=/usr/local/sbin:$path
— variables are case sensitive.
However, this error
-bash: export:`/usr/local/bin:/usr/local/sbin:': not a valid identifier
Indicates you probably have this in your bash_profile
export PATH=/usr/local/sbin:$path # PATH=/usr/local/sbin: export PATH=/usr/local/bin:$PATH # PATH=/usr/local/bin:/usr/local/sbin: export $PATH="$HOME/.rbenv/bin:$PATH" # .....^
Where you are substituting the variable on the left-hand side instead of providing the variable name.
You export a variable (name), not a variable’s value.