Mac commands

To temporarily set the path environment variable on macOS:

PATH=:$PATH

Permanently:

The way that macOS recommends is to add a file into the “/etc/paths.d/” directory. When you start a new terminal session, macOS will automatically read these files and add the folders to your path environment variable.

  1. Create a file under /etc/paths.d directory
    sudo nano /etc/paths.d/addmore
  2. Add paths to the file. Multiple lines allowed
    /home/addmore
    /etc/addmore/example
  3. After making these changes, save and quit by pressing CTRL + X, followed by Y, then the ENTER key.
  4. Only new sessions will see the addition to the path. Currently running sessions will not.