1

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

1
  • bash_profile and bashrc will only work (by default) if you actually use bash. I assume you know and made sure you run bash? Commented Sep 20, 2017 at 7:20

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.