MMark
MMark

Reputation: 149

Setting environment variables in either .bashrc or .bash_profile

I'm following the Learn Ruby on Rails - RailsApps tutorial. In the config section, it talks about opening either .bashrc or .bash_profile and seeing a export path command. Both of those files are blank. And the tutorial is asking me to record environment variables in one of those two files. I am assuming the file to be the one with an export path. Since both of my files are blank does it matter which file I record the environment variables to? Running OS X 10.9.4 and using rvm.

These are the variables:

export GMAIL_USERNAME="[email protected]"
export GMAIL_PASSWORD="Your_Password"
export MAILCHIMP_API_KEY="Your_MailChimp_API_Key"
export MAILCHIMP_LIST_ID="Your_List_ID"
export OWNER_EMAIL="[email protected]"

Upvotes: 4

Views: 4448

Answers (2)

Martin Konecny
Martin Konecny

Reputation: 59611

That tutorial was probably referring to Linux. In OS X it's more common to place this information into ~/.profile (Although adding to ~/.bash_rc should still work). This will only work if your ~/.bash_profile does not exist (see here)

Chances are your .profile will not be empty either.

Upvotes: 2

hahcho
hahcho

Reputation: 1409

Just add those things to .bashrc, if it doesn't exist in your home directory just create it.If you are wondering this are called enviorment variables and by export you make them available to the shell when your .bashrc is ran. This happens because every time you open a terminal your .bashrc is executed.It is not that simple but if you want deeper understanding read about bash and unix shell.

Upvotes: 1

Related Questions