2

I would like to set the PATH on my Mac 10.7.

So in /etc/launchd.conf I wrote:

setenv PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/:/usr/local/sbin/

and I restarted Mac.

However when I write in terminal

echo $PATH

I get:

/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/bin/:/usr/local/sbin/

How can I change the PATH param?

2
export PATH=$PATH:/path/to/my/stuff
1

Reset launchd.conf to its default settings. It's better to keep /etc files alone if you don't know what you are doing. :-)

Also, it's not advisable to completely overwrite your PATH; you can add directories to your pre-existing PATH in a very simple way.

You can change OS X's PATH parameter in the shell environment simply by editing ~/.profile or ~/.bash_profile. For example, in my .profile I have added some directories to my pre-existing PATH:

PATH="${PATH}:~/bin:/Users/Shared/bin:/usr/local/mysql/bin"

You have some subdirectories of /opt in your PATH. I guess that they have been added by MacPorts. If you want to remove them, simply comment out (#) or remove the corresponding lines in your .profile. To edit those hidden files, you can use CLI editors like vim or nano (included into OS X).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.