Adding to the system PATH environment variable on a Mac

One of the questions I sometimes get asked about Mac newbies, especially developers is how to add entries to the system (global) PATH environment variable.

Doing this is actually really simple.

As an example say we want to add the following directory to the PATH


Then we could simply do the following.

In your favourite editor create a new file ( you will need admin rights ) representing the name of your library or application in the following location:-


In my example the name of the file is “my-library”. However this can be any filename that doesn’t already exist.

The contents of this file is simply the full path to the folder you wish to add. In my example:-


You now need to restart your terminal session or your application. You should then be able to confirm your path is updated by running the following command:-

echo $PATH

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.