add a folder to the path

Let the shell find programs in a folder, for good, and reload the settings without logging out.

  • shell

Steps

  1. echo "$PATH" | tr : '\n'

    the folders searched now, one a line

  2. export PATH="$HOME/bin:$PATH"

    add ~/bin for this shell

  3. echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc

    add it for good (bash)

  4. source ~/.bashrc

    load the change now, without logging out

  5. fish_add_path ~/bin

    fish: adds it for good

Notes

  • zsh: ~/.zshrc. Login shells on macOS read ~/.zprofile or ~/.bash_profile.

Commands used

  • export
  • source

Each has a page in lore: lore export opens it.