Setting the PATH environment variable for your executables on Mac OS X

Sure, you can cd /wherever/your/program/lies, then run ./program_name, but thats lame!

I just installed PEAR and PECL in work, and it went int /usr/local/pear. Pear itself was in /usr/local/pear/bin, so thats the path we need to add.

From your terminal:

cd ~
nano .profile

Once Nano opens (or vi, emacs, whatever you like using as your command line text editor), add the following, and thats it!

export PATH=/path/to/your/bin:/maybe/more/folders:/one/more/for/good/measure:$PATH

As you can see, you can add several paths in the one line, just separate them by a :

Remember to quit and reload your terminal!

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s