Setting PATH environment variable in MAC

This probably most of the MAC users must be knowing, but still would like to document it.:

I had a pain myself figuring the way out. Following is the way(or should i say PATH??) to do it:

  • In your terminal, type cd /etc/paths.d/
  • touch mysql(this could be any name)
  • sudo vi mysql
  • [press i to insert] type in the path u want to append to the $PATH variable. In my case i wanted to set mysql’s path. So i had to type(copy paste rather) /usr/local/mysql/bin
  • [esc] :wq! to save the file.

U are done..

There is another way to set up $PATH, which is rather simple but wont be persisted with new sessions(new terminal or terminal tab).

To do so, in terminal u can just say export PATH=$PATH:<the path u want to append>

for ex., PATH=$PATH:/usr/local/mysql/bin

Advertisements

2 responses to this post.

  1. Posted by Siddhant on February 23, 2010 at 9:56 pm

    You could put the export statement inside .bash_profile (or .bashrc for that matter; .bash_profile on my system is just sourcing .bashrc) as well. That’ll make it persistent.

    Reply

  2. […] machine and the path to the postgres bin folder is in the $PATH enviroment variable. You can follow http://anooj.me/blog/?p=64 to set […]

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: