The first two things most people install for terminal work on a Mac are Homebrew, the package manager, and Vim, the text editor.
The short answer: Homebrew installs by pasting the one-line command from its official site, and Vim installs with brew install vim. The step people get stuck on is brew not being found afterwards, which happens because Homebrew moved to /opt/homebrew on Apple Silicon Macs.
This article covers installing Homebrew, fixing the PATH when the command is missing, installing Vim, and telling the Homebrew version apart from the one macOS already ships.
▼ Environment used to check this
macOS 26 (Apple Silicon) / Homebrew 6.x / zsh
Sponsored
How do you install Homebrew?
The short answer: paste the installation command from the official site into the terminal.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
This is the command shown on the front page of the Homebrew site. It does change from time to time, so check the site before running it.
You will be asked for a password, which is your Mac login password. If the Command Line Tools for Xcode are missing, their installation starts at the same time.
The install location depends on the chip
The short answer: Apple Silicon Macs install to /opt/homebrew, Intel Macs to /usr/local.
| Mac | Install location | Is it on your PATH? |
|---|---|---|
| Apple Silicon (M1 and later) | /opt/homebrew |
No. Needs setting up |
| Intel | /usr/local |
Yes, already |
Older tutorials assume /usr/local. When something does not work on an Apple Silicon Mac, suspect this first.
What to do when brew is not found
The short answer: if you get zsh: command not found: brew, add eval "$(/opt/homebrew/bin/brew shellenv)" to ~/.zprofile.
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
source ~/.zprofile
brew shellenv prints the environment variables Homebrew needs, including PATH, and eval applies them to the shell.
zsh has been the default shell since macOS Catalina, so writing to ~/.bash_profile will do nothing. The installer itself points at ~/.zprofile. Putting it in ~/.zshrc also works, but ~/.zprofile is read once at login shell startup, which is the more natural home for PATH setup.
Checking the install
The short answer: run brew doctor; Your system is ready to brew. means you are done.
brew --version
brew doctor
Sponsored
How do you install Vim?
The short answer: one line, once Homebrew is working.
brew install vim
Check the version afterwards.
vim --version
The macOS Vim and the Homebrew Vim are different
The short answer: macOS already ships Vim, so brew install vim leaves you with two. Use which -a vim, which lists every candidate, to see which one runs.
$ which -a vim
/opt/homebrew/bin/vim
/usr/bin/vim
which -a lists them in PATH order, so the one printed first is the one that runs. In this example that is /opt/homebrew/bin/vim.
If /usr/bin/vim comes first, Homebrew’s path is sitting after /usr/bin. Add the brew shellenv line above to ~/.zprofile and open a new terminal.
The bundled Vim changes only with macOS updates. The Homebrew build is whatever was current when you last ran brew upgrade vim, so the gap between the two versions differs per machine; check yours with the command above.
You may not need the Homebrew build
The short answer: if you only write a ~/.vimrc and change colours, the bundled Vim is enough.
The Homebrew build earns its place when you need compile-time options that Apple’s build leaves off, such as the Python interface some plugins require, or when you want to track new releases yourself. Starting with the bundled one and switching when it blocks you is a perfectly reasonable order.
Once the tools are in place, handling WebP files on a Mac with Quick Look and conversion is another job Homebrew makes easier. If you also want to tidy the terminal’s appearance and prompt, see setting up the Mac terminal with Iceberg and Prezto pure. Homebrew is also how you juggle language runtimes, and switching PHP versions on a Mac with Homebrew runs into the same PATH problem described above.