To add a directory to $PATH, sudo vi /etc/paths.d/ Then add as the content of the file. for example, to add npm into the $path we type "sudo vi /etc/paths.d/npm add "/usr/local/lib/node_modules/npm/bin" as content for the file. http://www.cyberciti.biz/faq/appleosx-bash-unix-change-set-path-environment-variable/