2

I am trying to set two environment variables on macOS version 10.15.5, I've opened a terminal and tried:

vi ~/.bash_profile

Added the exports to that, saved and exited vi, closed and reopened terminal, I don't see my new exports.

I've also tried:

vi ~/.profile

Added the exports to that, saved and exited vi, closed and reopened terminal, I don't see the exports there either.

What haven't I done?

2
  • Which shell are you using? – nohillside Jul 5 '20 at 11:12
  • @nohillside, zsh – SPlatten Jul 5 '20 at 11:17
2

Sorted, vi ~/.zshenv.

Added the exports, save and exit, restart terminal, my system was using the zsh terminal.

Or without restarting the terminal, just add:

source ~/.zshenv or source ~/.profile

After editing.

4
  • Each shell is different. But the manual page for the shell typically documents where it finds its startup scripts. E.g. In a terminal window, type man zsh – Tim Campbell Aug 4 '20 at 14:42
  • This solution only works for zsh – IgorGanapolsky Aug 7 '20 at 15:14
  • Unless .profile sources .zshenv sourcing this will not help :-) – nohillside Jan 29 at 16:40
  • @nohillside, I've done this many times on my own system it works. – SPlatten Jan 30 at 6:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .