How can I permanently add a class path to my Mac terminal?
12,912
Solution 1
Just add this entry to your CLASSPATH
environment variable in your .bashrc
:
export CLASSPATH="/Users/syalam/Library/android-sdk-mac_86/platform-tools:$CLASSPATH"
Solution 2
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!
Related videos on Youtube
Author by
Sheehan Alam
iOS, Android and Mac Developer. i can divide by zero.
Updated on July 02, 2022Comments
-
Sheehan Alam almost 2 years
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.
-
Sheehan Alam over 12 yearsThanks! What is the difference between setting PATH and CLASSPATH?
-
fge over 12 years
PATH
is the list of directories in which you shell will search for commands, in the order where they appear -- ie, if you typels
, the shell will search for/bin/ls
, then/usr/bin/ls
ifPATH
is/bin:/usr/bin
.CLASSPATH
is a list of directories where the JVM will look for classes. -
fge about 10 yearsUhm, I know it's been long, but... Why the downvote?
-
Coolio2654 over 5 yearsAfter many hours of going over quite a few answers here on stack overflow (and elsewhere), this was the only solution that ended up working on my mbp retina (2013), running mac OS 10.11.6. Thank you so much.