The file we have to modify is
/etc/paths
, which contains a list of paths that are added to the $PATH
variable.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
/usr/local/test/bin
.Follow these steps:
- Open the shell
- Type
sudo nano /etc/paths
- Add at the end of the list
/usr/local/test/bin
and enter your password - Press ctrl+X to exit, and Y to save changes
- Press enter
Problem solved!
Now, let's verify if everything went well.
Type in the shell (a new window is required!)
echo $PATH
You should see something like this (focus on the last item, which should be the directory you just added):
/usr/local/bin:/usr/bin:/opt/X11/bin:/usr/local/test/bin
No comments:
Post a Comment