In macOS Sierra 10.12.x, what is the modern way to add a directory to the PATH environment variable that can work across shells or specifically work with zsh shell (I switched from the default bash to zsh).
I have seen some Questions and Answers such as this one that are bash-specific. And I have seen some such as this one about launchd but it seems I've read launchd is not the right right in later versions of macOS (not sure). I could find no specific references for Sierra, so I am posting now.
I am trying to install Maven with instructions saying:
Add the bin directory of the created directory apache-maven-3.3.9 to the PATH environment variable
Best Answer
export
To change the path within your shell session, not system-wide, you can use the bash-style
export
command with zsh, as documented here.The name of the
PATH
variable is case-sensitive and must be all-uppercase.To verify your change, run:
You will see results like this.