-
Ubuntu, Debian, ArchLinux and most other ditributions:
- Open file
~/.profile
in any editor and add your directory toPATH
variable, for example:export PATH="$HOME/Documents/apps/bin:$PATH"
- Open file
-
OpenSuse Tumbleweed / Leap:
- Edit or create new system-wide file
/etc/profile.local
with root privileges, for example with terminal:sudo nano /etc/profile.local
- Add your directory to
PATH
variable in/etc/profile.local
:export PATH="$HOME/Documents/apps/bin:$PATH"
- Edit or create new system-wide file
-
All: after changing
PATH
variable logout and login to apply changes
Windows (gist)
- The first step depends which version of Windows you're using:
- If you're using Windows 8 or later, press the Windows key, then search for and select "System (Control Panel)".
- If you're using Windows 7, right click the "Computer" icon on the desktop and click "Properties".
- Click "Advanced system settings".
- Click "Environment Variables".
- Under "System Variables", find the
PATH
variable, select it, and click "Edit". If there is noPATH
variable, click "New". - Add your directory to the beginning of the variable value followed by
;
(a semicolon). For example, if the value wasC:\Windows\System32
, change it toC:\Users\Me\bin;C:\Windows\System32
. - Click "OK".
- Restart your terminal.
MacOS (stackoverflow)
- Open up Terminal.
- Run the following command:
sudo nano /etc/paths
- Enter your password, when prompted.
- Go to the bottom of the file, and enter the path you wish to add.
- Hit
control-x
to quit. - Enter
y
to save the modified buffer.