jaycode
jaycode

Reputation: 2958

$PATH variable on Mac OS 10.6 Server keeps resetting back

In a terminal window I run:

export PATH=$PATH:/usr/local/mysql/bin>> ~/.bash_profile

Then when I echo $PATH the new path shows alright.

But if I close that window, open another window, the path disappears!

How to change the PATH variable?

Upvotes: 17

Views: 16745

Answers (3)

Quentin
Quentin

Reputation: 943097

The command you have will set the path and then put the output from that command at the end of your .bash_profile.

You want to put the command itself into the .bash_profile.

echo 'export PATH=$PATH:/usr/local/mysql/bin' >> ~/.bash_profile

It won't take effect until you start a new terminal session.

Upvotes: 41

vasily
vasily

Reputation: 101

You don't need to start a new Terminal session in order to apply the changes to the ~/.bash_profile.

Just type in the Terminal

    source ~/.bash_profile

Upvotes: 10

Michael J. Barber
Michael J. Barber

Reputation: 25032

You need to save the

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

in the .bash_profile, as you're trying. However, the export statement is not just displayed text, so appending it won't work. Use an editor to do it.

Upvotes: 3

Related Questions