How do you set the PATH in your .profile file?

2

Possible Duplicate:
What are PATH and other environment variables, and how can I set or use them?

I'm currently trying out Homebrew and it has told me to list it's folder before the default installation path in the .profile.

After some googling it appears that I have to make this file myself as it is not generated. But I have no idea what a file like this looks like and I struggle finding any examples through the normal channels i.e Google.

Could you guys be of assistance?

Eivind E B

Posted 2012-11-19T08:24:19.637

Reputation: 21

Question was closed 2012-11-19T11:14:32.640

Simply add export PATH=/usr/local/bin:$PATH to your ~/.bash_profile or ~/.profile (if you want it for other shells as well). – slhck – 2012-11-19T11:15:10.003

You edit /etc/paths to have "/usr/local/bin" on top to have Homebrew's packages be prioritised. – Eivind E B – 2013-04-14T12:04:41.403

Answers

0

On OS X there are several locations where you can define $PATH. One is ~/.bash_profile (Terminal.app starts the shell as a login shell on OS X, so it has to be .bash_profile instead of .bashrc). This affects only bash. The other is ~/.MacOSX/environment.plist which can be edited either with the plist editor (if you have XCode installed) or the defaults command. This affects all GUI applications.

However, according to this article environment.plist doesn't work in Mountain Lion anymore and you have to add a line setenv PATH /bin:/usr/bin:... to /etc/launchd.conf instead.

Ansgar Wiechers

Posted 2012-11-19T08:24:19.637

Reputation: 4 860

-1

Found this:

export PATH=$PATH:/opt/local/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/local/lib

alias sl='ls'
alias pwd='echo -n `pwd` | pbcopy'

From https://stackoverflow.com/questions/5509587/unix-making-change-to-profile-file

Juha Untinen

Posted 2012-11-19T08:24:19.637

Reputation: 664

This doesn't work since Homebrew isn't installed in /opt. Furthermore, only the first line would be necessary. The three others are irrelevant to the question and setting the LD_LIBRARY_PATH is not encouraged. Also, the OP wanted to have Homebrew folders before other PATH directories, not after. – slhck – 2012-11-19T11:13:44.297