SilverWebBuzz

brew command not found

brew command not found
Get in Touch With Us
Submitting the form below will ensure a prompt response from us.

    Getting the brew: command not found error? Don’t worry — you’re not alone. This guide is a complete, step-by-step fix for macOS, Linux, and even Windows users using WSL. Whether you’re just getting started with Homebrew or accidentally uninstalled it, here’s everything you need to know to resolve it quickly.

    What is the “brew command not found” Error?

    This error means the terminal doesn’t recognize the brew command. It usually happens when:
    • Homebrew is not installed properly.
    • The PATH environment variable doesn’t include Homebrew’s path.
    • You’re using a shell like Zsh or Bash, and it’s not configured to recognize brew.

    Fix for macOS Users

    1. Check if Homebrew is installed

    Open Terminal and run:

    brew –version

    If you see command not found , proceed to install it.

    2. Install Homebrew (Official Way)

    Paste this in your Terminal:
    /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”

    3. Add Homebrew to your PATH

    Depending on your shell:

    For Zsh (macOS default now):

    echo ‘eval “$(/opt/homebrew/bin/brew shellenv)”‘ >> ~/.zprofile source ~/.zprofile

    For Bash:

    echo ‘eval “$(/opt/homebrew/bin/brew shellenv)”‘ >> ~/.bash_profile source ~/.bash_profile

    For Intel Macs, use this path:

    echo ‘eval “$(/usr/local/bin/brew shellenv)”‘ >> ~/.zprofile source ~/.zprofile

    4. Test the fix

    Run:
    brew doctor
    If it says “Your system is ready to brew,” you’re all set.

    Fix for Linux Users (Ubuntu, Debian, Fedora, etc.)

    1. Install Required Dependencies

    sudo apt-get update
    sudo apt-get install build-essential curl file git

    2. Install Homebrew on Linux

    Run:
    /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”

    3. Add Homebrew to your PATH

    echo ‘eval “$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)”‘ >> ~/.bashrc source ~/.bashrc
    Or for Zsh:
    echo ‘eval “$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)”‘ >> ~/.zshrc source ~/.zshrc

    4. Test Homebrew

    brew –version

    Fix for Windows Users (WSL)

    Windows doesn’t support Homebrew natively, but it works inside WSL (Windows Subsystem for Linux).

    1. Install WSL & Ubuntu

    Open PowerShell as Administrator:
    powershell
    wsl –install
    After rebooting, Ubuntu will be installed by default.

    2. Install Linuxbrew in WSL

    Open your Ubuntu WSL shell:

    /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”

    3. Add to PATH

    Add this to your ~/.bashrc or ~/.zshrc:
    eval “$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)”
    Then run:
    source ~/.bashrc

    4. Check the installation

    brew doctor

    Pro Tips for All Users

    • Always restart your terminal after installing or editing .zshrc / .bashrc .
    • If using Oh My Zsh, make sure it doesn’t override your PATH.
    • Use brew doctor to detect common issues.
    • To reinstall Homebrew:
    /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)”
    Then reinstall again.

    This guide covers every possible setup (macOS Intel/ARM, Linux, WSL) — so no matter what you’re using, your “brew: command not found” issue should be solved now.

    About Author

    Bhavik Koradiya is the CEO / Co. Founder of Silver WebBuzz Pvt. Ltd. Having 18+ years Experience in LAMP technology. I have expert in Magento, Joomla, WordPress, Opencart, e-commerce and many other open source. Specialties: Magento, WordPress, OpenCart, Joomla, JQuery, Any Open source.

    Scroll to Top