ZSH: command not found: brew

ZSH: command not found: brew

If you get the error "zsh: command not found: brew" it means that your system does not recognize the brew command. This can happen if you haven't installed Homebrew on your computer or if it was installed but not added to your PATH environment variable.

To fix this error, you can try the following steps:

  1. Check if Homebrew is installed on your computer by running the command which brew. If this command returns a path, then Homebrew is installed and you can skip to step 4.

  2. If Homebrew is not installed, you can install it by running the following command in your terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. After installing Homebrew, you need to add it to your PATH environment variable so that your system can find the brew command. To do this, you can add the following line to your .bash_profile or .zshrc file (depending on which shell you are using):

export PATH="/usr/local/bin:$PATH"
  1. After updating your PATH variable, you will need to close and reopen your terminal window for the changes to take effect. You can then try running the brew command again to see if it works.

If you are still getting the "command not found" error after following these steps, you can try running the brew doctor command to diagnose any issues with your Homebrew installation. This command will check your system for any potential problems and provide suggestions for how to fix them.

What is brew

Brew or Homebrew is a package manager for macOS. It is used to install, update, and manage software packages on a macOS computer. It is similar to other package managers, such as apt on Linux or npm on Node.js.

Brew allows you to easily install, update, and manage command-line tools and other open-source software. This can be useful for developers who need to use certain tools or libraries on their computers but don't want to spend time manually downloading and installing them. Brew also makes it easy to keep your installed software up to date, so you can be sure you're always using the latest version.

Brew is a command-line tool, so you can use it by opening a terminal window on your macOS system and running the brew command followed by the desired subcommand. For example, you can use the brew install command to install a package or the brew update command to update all your installed packages to the latest versions.

Brew is free and open-source software, and it is available for anyone to use. It is maintained by a community of volunteers who contribute to the project and help ensure it is up-to-date and properly working. You can learn more about Brew and how to use it on the official Homebrew website.

Useful links:

Homebrew official website