command not found after installing

You installed a program but the shell says "command not found": find where it went and let the shell see it.

  • shell
  • packages

Steps

  1. hash -r

    make the shell forget its old list of commands

  2. ls ~/.local/bin ~/.cargo/bin ~/go/bin

    where pip, cargo and go put programs

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

    the folders the shell searches

  4. exec "$SHELL" -l

    start the shell again, reading the new settings

  5. eval "$(/opt/homebrew/bin/brew shellenv)"

    macOS, Homebrew on Apple Silicon: add brew to this shell

  6. npm prefix -g

    where npm installs global programs

Notes

  • When the folder is missing from PATH, see "add a folder to the path".

Commands used

  • hash
  • echo
  • brew
  • npm

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