Last Updated: February 25, 2016
·
357
· jinnko

Updating the PATH on the OSX CLI

Whether you use bash, csh, tcsh or zsh (my choice), it's not the most straight forward thing to update your path to search /usr/local/bin/ for scripts before using what's in /usr/bin/. I had some nice .zprofile fu going on to cleanly apply $PATH entries without duplicates, but no matter what ordering I used I would always have my local path appear after the system path.

Turns out OSX has something called /usr/libexec/path_helper the "help" you have a headache.

The solution in the end was to edit /etc/paths and reorder the lines in there to look like this:

$ cat /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

Now any new shells you open will search /usr/local/bin/ before /usr/bin.