If you’re a Mac user and have encountered the “Warning: Not on Path” message, it can be confusing, especially if you’re unfamiliar with command-line operations or development environments. This warning usually appears when working with Terminal or while installing new software or command-line tools.
In this article, we’ll explore what this message means, why it appears, and how to resolve it step by step.
Table of Contents
1. What Does “Not on Path” Mean?
In macOS (as with other UNIX-based systems), PATH refers to an environment variable that specifies directories where executable programs are located. When you run a command in the Terminal, macOS looks for the corresponding executable file in the directories listed in your PATH.
If you see the warning “Not on Path,” it means that the command or program you’re trying to run is not in one of the directories specified by the PATH environment variable. As a result, the system cannot find or execute the command unless you provide the full path to it.
2. Why Does This Warning Appear on a Mac?
This warning typically appears in the following scenarios:
- You have installed a program, but the installation didn’t automatically add it to the PATH.
- You’re trying to run a program or command that isn’t located in one of the standard system directories (like /usr/local/bin or /usr/bin).
- The program is installed in a custom location, and you need to manually add that location to your PATH.
Common cases where users see this warning include:
- Installing third-party software like Homebrew or programming languages (e.g., Python or Node.js).
- Using developer tools that are not installed in default locations.
3. How to Fix the “Not on Path” Warning on macOS
To resolve this issue, you will need to add the program’s location to the PATH environment variable manually. Let’s walk through the steps to do that.
Step 1: Check Your PATH
To see the current directories included in your PATH, follow these steps:
1. Open Terminal on your Mac.
2. Type the following command and press Enter:
  echo $PATH
3. The output will display a list of directories separated by colons. For example:
  /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
These are the directories macOS checks when you type a command. If the program you’re trying to run isn’t located in one of these directories, macOS won’t be able to find it.
Step 2: Locate the Software or Command Path
Now, you need to find the path to the program or executable that is causing the “Not on Path” warning. Let’s assume you installed a program in a custom directory.
1. In the Terminal, navigate to the directory where the program is installed using the cd command, or find the path by using a command like find or which. For example, if you’re looking for Node.js:
  which node
2. This will return the full path to the node executable, such as:
  /usr/local/bin/node
Make a note of this path.
Step 3: Edit Your Shell Configuration File
Now that you know the correct path to the program, you need to add it to the PATH environment variable. To do this, you’ll need to edit the shell configuration file. The exact file depends on the shell you’re using (Bash or Zsh).
– For Zsh (default for macOS Catalina and later), the file to edit is ~/.zshrc.
– For Bash (older macOS versions), edit the ~/.bash_profile file.
1. Open the shell configuration file using a text editor. In Terminal, use the nano editor:
  For Zsh:
    nano ~/.zshrc
  For Bash:
    nano ~/.bash_profile
Step 4: Add the Correct Path
Next, add the new path to your PATH variable. Scroll to the bottom of the file and add the following line (replace /path/to/program with the actual path you found earlier):
export PATH=”/path/to/program:$PATH”
For example, if you want to add Node.js installed in /usr/local/bin, your line would look like this:
export PATH=”/usr/local/bin:$PATH”
This command prepends the new path to the beginning of your PATH variable, ensuring the system checks there first.
Step 5: Apply Changes and Verify
Once you’ve edited the configuration file, the next step is to apply the changes.
1. Save the file and exit the editor (in nano, press Ctrl + O to save, then Ctrl + X to exit).
2. Apply the changes by running:
  For Zsh:
    source ~/.zshrc
  For Bash:
    source ~/.bash_profile
3. Finally, verify that the program is now accessible by checking the PATH again or running the command. For example, if you added Node.js, type:
  node -v
If everything was done correctly, the command should execute without any “Not on Path” warning.
Conclusion
The “Warning: Not on Path” message on macOS can seem intimidating, but it’s simply the system letting you know that it can’t find the command you’re trying to run. By understanding how to check and modify your PATH environment variable, you can easily resolve this issue and ensure your system knows where to look for the correct executable files.
By following the steps in this guide, you’ll be able to fix the warning and continue using your tools and software without interruption.