I believe I have a corrupted file in my bash unix shell on Mac OS X (10.12.3). Upon opening a terminal I don’t have access to bash. The only thing I can do is run % echo $PATH which returns:
/usr/local/share/npm/bin:/Users/greg/mongodb/bin:/Users/g
I can restore access to bash using
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH
After doing this and checking the $PATH variable, I see
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/share/npm/bin:/Users/greg/mongodb/bin:/Users/g
However, if I open a new terminal window, none of the $PATH info that I just added is there.
Following this Stackoverflow post I'm looking at the places where these variables are supposed to be set.
Looking in /etc/paths I see the following:
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/Users/greg/mongodb/bin
A /etc/profile doesn’t exist
My ~/.bash_profile looks like this
export PATH=/usr/local/share/npm/bin:/Users/greg/mongodb/bin:/Users/g
reg/anaconda2/bin:/Applications/Postgres.app/Contents/Versions/latest
/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/bin:/b
in:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Library/Framewor
ks/Mono.framework/Versions/Current/Commands:/Applications/Visual
Studio Code.app/Contents/Resources/app/bin:
My ~/.profile looks like this
export NODE_PATH="/usr/local/lib/node"
export PATH="/usr/local/share/npm/bin:$PATH"
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Everything looks okay to me. Does this indicate that bash is using another file to set the environment variables including $PATH info? If so, where is it located? And why don’t the $PATH variable changes I make persist?