With following steps we can add a variable directory to Mac Os X PATH permanently, so it will be there for always.
First, Lets find out your current PATH value.
To do that, Within the terminal, Fire this command:
echo $PATH
This should output the paths that are exist in your PATH now:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Now, Assume that we want add this path:
/Users/Android/sdk/platform-tools
To do this, We need to edit the .bash_profile
and add it to the PATH variable.
-
Within the Terminal, run
vim ~/.bash_profile
-
Type
i
and then paste the following at the top of the file:export PATH=/Users/Android/sdk/platform-tools:$PATH
-
Hit
ESC
, Type:wq
, and hitEnter
-
In Terminal, run
source ~/.bash_profile
-
In Terminal, type in
echo $PATH
again and look for the updated string. If everything was successful, It should output the new path to your directory.
this is the updated PATH for me:
/Users/Android/sdk/platform-tools:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
- In case it doesn't output the correct path, try closing the terminal window (exit fully) and open again, it should apply the changes (Restart in short).