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

asked Sep 20, 2017 at 5:50
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

answered Sep 20, 2017 at 13:11
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.