I have a requirement where I need to set a custom environment variable called CLUSTER_ENV = '@fooURL'
The steps I have followed are:
- Open terminal, open
bash_profileand saveCLUSTER_ENV='@foo'. When I doecho $CLUSTER_ENV, I get blank output. - I did the same thing in the
bashrcfile and in this case, the$CLUSTER_ENVshows 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/
Hans Petter Taugbøl Kragset
1,0197 silver badges18 bronze badges
asked Sep 20, 2017 at 5:50
SeaWarrior404
4,18816 gold badges47 silver badges66 bronze badges
-
bash_profile and bashrc will only work (by default) if you actually use bash. I assume you know and made sure you run bash?Hans Petter Taugbøl Kragset– Hans Petter Taugbøl Kragset2017年09月20日 07:20:38 +00:00Commented Sep 20, 2017 at 7:20
1 Answer 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
Sergiu
3,2533 gold badges31 silver badges39 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
Explore related questions
See similar questions with these tags.
lang-bash