SeaWarrior404
SeaWarrior404

Reputation: 4167

How to set custom Environment variable on Mac?

I have a requirement where I need to set a custom environment variable called CLUSTER_ENV = '@fooURL' The steps I have followed are:

  1. Open terminal, open bash_profile and save CLUSTER_ENV='@foo'. When I do echo $CLUSTER_ENV , I get blank output.
  2. I did the same thing in the bashrc file and in this case, the $CLUSTER_ENV shows the value only when I run it in the same terminal window.

Which is the best or recommended way to permanently set the environment variable on a Mac? Im running El Capitan.

I have gone through these links for reference:

http://osxdaily.com/2015/07/28/set-enviornment-variables-mac-os-x/

Mac OS X 10.9 - setting permanent environment variables

Upvotes: 1

Views: 1528

Answers (1)

Sergiu
Sergiu

Reputation: 3185

As you will normally do on any Linux distro: export CLUSTER_ENV=my.url.com which will have to be added to ~/.bash_profile

Upvotes: 1

Related Questions