Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I permanently add a class path to my Mac terminal?

I want to set my path permanently for the following directory:

/Users/syalam/Library/android-sdk-mac_86/platform-tools

Not sure how to do it from the terminal. I tried:

export PATH=$PATH:/Users/syalam/Library/android-sdk-mac_86/platform-tools

but it only works temporarily. After I close my shell it no longer exists.

like image 857
Sheehan Alam Avatar asked Dec 25 '11 14:12

Sheehan Alam


People also ask

How do you make a path permanent on Mac?

For a new path to be added to PATH environment variable in MacOS just create a new file under /etc/paths. d directory and add write path to be set in the file. Restart the terminal. You can check with echo $PATH at the prompt to confirm if the path was added to the environment variable.


2 Answers

Just add this entry to your CLASSPATH environment variable in your .bashrc:

export CLASSPATH="/Users/syalam/Library/android-sdk-mac_86/platform-tools:$CLASSPATH"
like image 127
fge Avatar answered Oct 31 '22 16:10

fge


http://blog.just2us.com/2011/05/setting-path-variable-in-mac-permanently/

Set permanently for a user:

Edit the user’s bash profile (replace USERNAME)

pico ~USERNAME/.bash_profile

Insert (or edit) this line

PATH=$PATH:/my/new/path/

Press ctrl-x, then ctrl-y, to save the file.

Done.

Set for all users

sudo pico /etc/paths

Enter your superuser password to edit, and insert or edit this link

PATH=$PATH:/my/new/path/

That’s it! Enjoy your path!

like image 26
Ravi G Avatar answered Oct 31 '22 15:10

Ravi G