# How to add to PATH variable on Mac OSX

PATH variables are useful for some namely CLI (command line interface) apps. PATH variables allow certain apps to be accessed globally. So you don’t have to remember the full path to the app to use it. It stops things like this:

/sbin/ifconfig - with no PATH variable assigned.

ifconfig - with PATH variable assigned.

#### Adding the app path to the PATH variable.

All we need to do is create a new hidden file called: .bash_profile in your user home. so open up a terminal and type the following.

touch ~/.bash_profile
nano ~/.bash_profile

Inside the .bash_profile file you want to type something like this it will be different depending on what you want to do.

you want to make sure that you enter the parent folder not the direct command as it will not work.

export PATH="/Path/to/folder/:$PATH" so an example would be something like for composer. you would enter this. export PATH="/Users/user/.composer/vendor/bin:$PATH"

As you can see it’s going to the bin directory, not to the actual composer file.

#### Testing the new path variable.

Restart the terminal and test if this has worked by entering this in the terminal.

echo \$PATH

If you get something like this.

/Users/user/.composer/vendor/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin