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.
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.
so an example would be something like for composer. you would enter this.
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.
If you get something like this.