How to add exports to .zshrc
Solution 1:
Just run open ~/.zshrc
on the command line, which will open your .zshrc
file in your default text editor (usually TextEdit) and, as long as you save it as plain text, you’ll be fine.
It doesn’t really matter where you paste it into your .zshrc
file, as nothing else in there depends on it.
There’s no magic to .zshrc
, other than that zsh
will automatically execute it on startup; it’s just a text file. The only requirement is that it has valid Zsh code inside.
In general, I wouldn't recommend you echo
or print
straight to .zshrc
(despite many examples and instructions doing so). It’s too easy to “accidentally the whole thing”.