The file we have to modify is
/etc/paths, which contains a list of paths that are added to the
All the executable files contained in the directories listed in this file can be launched on the shell using their name.
Suppose we have to add git executables to the path variables, and their directory is
Follow these steps:
- Open the shell
sudo nano /etc/paths
- Add at the end of the list
/usr/local/test/binand enter your password
- Press ctrl+X to exit, and Y to save changes
- Press enter
Now, let's verify if everything went well.
Type in the shell (a new window is required!)
You should see something like this (focus on the last item, which should be the directory you just added):