Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using Mac OS X Snow Leopard. Which folder do I create my .profile file in?

I like to create a path for /usr/local/mysql/bin – any tips on how to export this path? I only know how to type it for .bash_profile.

share|improve this question

2 Answers 2

You create .profile in the same folder as .bash_profile, namely in /Users/your-user-name/ also available under ~ or $HOME.

You can add the line using a text editor or command line editor of your choice (like vim, emacs or nano), but you can also do it with Text Edit:

open -a TextEdit ~/.bash_profile

Where to put the export command?

One important thing: If you already have a .bash_profile, your .profile will not be loaded automatically. From bash's manual:

it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.

Because of that, when you already have a ~/.bash_profile file and create a ~/.profile, the latter will never be read by bash automatically. You can add the appropriate export command in your ~/.bash_profile and it will work just fine if you always use bash:

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

Source .profile from .bash_profile

If you want to have a separate .profile, you need to manually include it from ~/.bash_profile. Put the following in ~/.bash_profile:

source ~/.profile
share|improve this answer

In Terminal:

open .profile

If that doesn't work, go to your home directory:

sudo nano .profile

and add:

export PATH=$PATH:/usr/local/mysql/bin/
share|improve this answer
2  
Shouldn't need sudo to edit .profile in your home directory. –  fideli Jul 21 '11 at 17:22
    
In addition it might be better to have your custom path in front of $PATH, so that your local MySQL binary always comes first. –  slhck Jul 22 '11 at 9:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.