Path environmental variable on mac

To view your paths in terminal type:
$ echo $PATH

To add a path for the duration of this terminal session type:
$ export PATH=$PATH:/my/new/path
Note: the $PATH: is important as it adds the new path to your existing one. Without $PATH: the existing path is overwritten with the new one.
The disadvantage with this approach is that you modification to the path is lost when the terminal session ends.

To add to the path for all users permanently you need to edit the paths file in /etc. 
In terminal navigate to /etc.
Type $ sudo pico paths
Add your path.
Type ^x (note: ^ = ctrl key).
You'll be prompted to save. Type Y.
To view your paths using echo $PATH you'll need to reopen the terminal to see your changes.

Comments

Popular posts from this blog

Setting up node-sass on a mac