MacOS – Fixing a messed up $PATH in Yosemite

homebrewmacospathterminal

I had troubles installing node with Homebrew as Homebrew does something weird to the node install that installing Yeoman generators seems to be hindered a bit. My issue, however, is that I think Homebrew messed up my $PATH.

I installed node via the download from their site and it says:

Make sure that /usr/local/bin is in your $PATH.

However when I go into iTerm and type echo $PATH I get:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin

Is this normal, or do I have to fix something?

I thought it would just spit out /usr/local/bin/.

Best Answer

This is normal. System binaries are located in /usr/bin and other such directories that need to be in your path so that you can run them without needing to type the entire path in your shell.

Homebrew and other such package managers tell you to add the path to the folder for their own binaries so that they can also be run without typing the entire path. This folder should be added to the list of paths so that both the original binaries and the new binaries can be run in the same way.

FWIW I have plenty of paths in my $PATH:

/Users/grgarside/.autojump/bin:/Users/grgarside/.autojump/bin:/Users/grgarside/.rvm/gems/ru
by-2.0.0-p247/bin:/Users/grgarside/.rvm/gems/ruby-2.0.0-p247@global/bin:/Users/grgarside/.r
vm/rubies/ruby-2.0.0-p247/bin:/Users/grgarside/.rvm/bin:/usr/local/bin:/usr/local/sbin:/usr
/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sb
in:/sbin:/opt/X11/bin:/Users/grgarside/.rvm/bin