Adding the PATH variable on Mac OSX

This is another one of those blog entries where I want to blog for the sake of remembering tedious details…

The issue that I was facing was how to add a directory to the PATH environment variable on my Mac.

I wanted to add a path to MySQL install. So I’ll use that example. The following command in a Terminal window created my .bash_profile file. If the file already exists, it would have added to that file.

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

The PATH information is stored in /Users/username/.bash_profile file.

Leave a comment

3 Comments.

  1. thanks, worked for me except I used .profile, OS X Leopard.

  2. Finally found THE line that worked… The commands posted on the MySQL website works just that particular time but if you close Terminal and go back again doesn’t work. Thanks a lot

  3. I put this line in .profile file and it worked:
    export PATH=/usr/local/mysql/bin:$PATH

    I use Mac OS X 10.5.8.

    Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>