Sunday, January 16, 2011

Where should I modify the PATH var on OS X?

I recently installed MySQL on a new Mac OS 10.6.1 Snow Leopard system. MySQL seems to be running according to the control panel and the output of ps aux | grep mysql. However, on the command line the mysql command is not available because (I think) the dir /usr/local/mysql/bin is not in the PATH.

I could add this to /etc/bashrc...

export PATH=$PATH:/usr/local/mysql/bin

Yes, OK that worked.

But is that the right way to do it? Should I add it to /etc/profile instead? Or something else?

  • That is the correct way to do it. /etc/profile is for login or non-interactive shells

  • Another option is to set PATH in ~/.MacOSX/environment.plist. You can use RCEnvironment to edit environment.plist. One downside of environment.plist is that it doesn't expand environment variables, so you can't append to a variable. The upside is that it works for all applications, not just those run from a terminal.

    From outis

0 comments:

Post a Comment