Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$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?

like image 583
jaycode Avatar asked May 07 '11 07:05

jaycode


People also ask

What does $PATH mean Mac?

 PATH is a system-level variable that holds a list of directories. When you enter a command in the terminal, it's shorthand for a program with the same name. The system looks in each of the PATH directories for the program corresponding to the command.

Where is PATH variable stored in Mac?

The default PATH and MANPATH values are in /etc/paths and /etc/manpaths . And also the path-helper reads files in the etc/paths. d and /etc/manpaths. d directories.

How do you delete a PATH variable on a Mac?

I searched on how to remove variables from $PATH and followed these steps : Gave the command PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin" Did echo $PATH which showed /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin. gave the command export PATH.


2 Answers

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.

like image 87
Quentin Avatar answered Oct 25 '22 13:10

Quentin


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
like image 34
vasily Avatar answered Oct 25 '22 13:10

vasily