Is it possible to set PATH on Mac OS X Lion without restarting?

4

1

Is there a way to set the PATH on /etc/paths without the need to reboot your Mac? I know I can do it using an alias but it's not permanent.

For example, I want to set the PATH for MySQL.

giolicious

Posted 2011-10-11T05:17:23.257

Reputation:

Answers

3

I assume you want the PATH variable to be set in your terminal environment. If you are using bash (default on Mac OS X) you can add

export PATH=${PATH}:/your/path/to/mysql

to your .bashrc file in the home directory

Matteo

Posted 2011-10-11T05:17:23.257

Reputation: 6 553

1

It is not possible to update the system-wide path.

You can execute the line specified by @Matteo though (without needing to add to .bashrc / .bash_profile) and then launch all applications from Terminal. They will inherit the modified $PATH value.

Daniel Beck

Posted 2011-10-11T05:17:23.257

Reputation: 98 421

1

Why can't you set the path in /etc/bashrc? Seems like this would be system-wide.

seity

Posted 2011-10-11T05:17:23.257

Reputation: 11

1

Straightforward way to edit PATH env variable for Terminal mode:

(This is just a different way to do what is mentioned above in case you don't have R/W permission, as I did not)

Navigate to the /private/etc/paths in Finder, r-click, Get Info, Select Sharing & Permissions, change Everyone to Read & Write, edit and save the file (append the new path to the end of the list), then restore the permissions if necessary.

Rory Sellers

Posted 2011-10-11T05:17:23.257

Reputation: 11

0

After you set the PATH, in a Terminal window you can just type source ~/.bash_profile and hit enter. To verify that your PATH is updated, just execute echo $PATH.

SammyRNYCreal

Posted 2011-10-11T05:17:23.257

Reputation: 101