Skip to content

Fixing "Warning: /opt/homebrew/bin is not in your PATH" on macOS M1

Problem Overview

When installing Homebrew on macOS Big Sur with an M1 chip, many users encounter the warning:

Warning: /opt/homebrew/bin is not in your PATH.

This warning indicates that while Homebrew has been successfully installed to /opt/homebrew/, your system doesn't know where to find the Homebrew executables. The /opt/homebrew/ location is specifically used for ARM-based installations on Apple Silicon (M1) Macs.

Why This Happens

Homebrew changed its installation path for Apple Silicon Macs:

  • Intel Macs: /usr/local/bin
  • Apple Silicon (M1/M2) Macs: /opt/homebrew/bin

This separation allows both Intel and ARM versions of Homebrew to coexist on the same machine. The warning appears because your shell's PATH environment variable doesn't include the new location.

Solution: Add Homebrew to Your PATH

The most straightforward solution is to add the Homebrew path to your shell configuration file.

Method 1: Basic PATH Modification

  1. Edit your shell configuration file:

    • For Zsh (macOS Catalina and later): ~/.zshrc
    • For Bash: ~/.bashrc or ~/.bash_profile
  2. Add the following line at the end of the file:

    bash
    export PATH="/opt/homebrew/bin:$PATH"
  3. Reload your shell configuration:

    bash
    source ~/.zshrc  # or source ~/.bashrc

If you use your configuration across multiple machines with different architectures, use this conditional approach:

bash
# Add to your ~/.zshrc or ~/.bashrc
if [[ "$(uname -m)" == "arm64" ]]; then
    export PATH="/opt/homebrew/bin:${PATH}"
fi

This only adds the path when running on Apple Silicon hardware, making your configuration portable.

After installation, Homebrew often provides specific commands to complete setup. Check for any "Next steps" messages and run the provided commands, which typically include:

bash
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc
eval "$(/opt/homebrew/bin/brew shellenv)"

Verifying the Fix

After making changes, verify that Homebrew is accessible:

bash
brew --version

You should see Homebrew's version information without any "command not found" errors.

Additional Considerations

INFO

Homebrew has officially supported Apple Silicon since version 3.0.0. If you have an older version, run brew update to get the latest updates with full M1 support.

WARNING

If you don't have a shell configuration file, create one using:

bash
touch ~/.zshrc  # or touch ~/.bashrc

For those who previously installed Homebrew under Rosetta 2, note that native Apple Silicon support is now recommended and generally works well for most packages.

Troubleshooting

If you still encounter issues:

  1. Ensure Xcode Command Line Tools are installed:

    bash
    xcode-select --install
  2. Verify your architecture:

    bash
    uname -m

    Should return arm64 for M1/M2 Macs.

  3. Check your current PATH:

    bash
    echo $PATH

    Ensure /opt/homebrew/bin appears at or near the beginning.

Conclusion

The PATH warning is a common but easily resolved issue when installing Homebrew on Apple Silicon Macs. By adding the appropriate path to your shell configuration, you'll ensure Homebrew commands work correctly while maintaining compatibility with both Intel and ARM architectures.

The solutions provided above will resolve the warning and ensure your Homebrew installation functions properly on your M1 Mac.