Easy way to control PATH in MacOS

pleng
May 7, 2021
  1. if you install OH MY ZSH add text to file .zshrc
for f in ~/profile.d/*; do source $f; done

2. create folder profile.d in path ~ such as go

3. add text in file go and source it

export GOROOT=${HOME}/bin/go/go.1.16.3
export GOPATH=${HOME}/go
export PATH="${GOROOT}/bin:${GOPATH}/bin:${PATH}"
## incase install go by brew install
export GOROOT="$(brew --prefix golang)/libexec"

4. if you have other environment variable create new file by type such as php, oracle

References

Thank you Chokchai Phatharamalai for teach me about this 😁

--

--