Link: mac

Edit $HOME/.bash_profile file to set or change $PATH under macOS

  1. Open the Terminal app on macOS.
  2. Enter below command to open .bash_profile
    vi $HOME/.bash_profile
    # Or, alternatively, use nano as editor (more user friendly for people who doesn't know vim key binding)
    nano $HOME/.bash_profile
  3. Add the desired PATH
    # e.g. for emacs PATH, it looks like this:
    export PATH="$HOME/.emacs.d/bin:$PATH
  4. Save and close in terminal. For vi/vim, enter :wq to save and exit.
  5. Enter below command in Terminal to apply the change
    source $HOME/.bash_profile
  6. Verify
    echo "$PATH"