How to edit PATH variable on Mac

If you need to change your PATH variables (or another environment variable, as CLASSPATH) on a Mac OS X, you need to edit a file called .profile located in your home directory. Open a terminal window and type:

open -e ~/.profile

In case you dont have a .profile file, you have to create it:

touch ~/.profile

You have to include a line like this:

export PATH=(path-you-want-to-add):$PATH

For example, lets imagine you want to add the file whatever.jar, located in your Documents folder. You would write:

export PATH=~/Documents/whatever.jar:$PATH

Easy, isnt it?

Bookmark and Share

1 Comment »

RSS feed for comments on this post. TrackBack URI

  1. Thanks a lot! You saved me a lot of time and trouble. In a few lines, you explained what other sites using entire pages had failed to explain.

    Comment by Ali — August 8, 2009 #

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds. Valid XHTML and CSS.