If you don't have sudo access (like on a work-managed machine), you can still install Homebrew locally.
-
Create a Homebrew directory:
mkdir -p ~/homebrew -
Download and install Homebrew into the local directory:
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew -
Update your PATH: Add the following to your
~/.zshrcor~/.bash_profile(depending on your shell):export PATH="$HOME/homebrew/bin:$PATH"
-
Apply the new PATH:
source ~/.zshrc # or ~/.bash_profile if you're using bash
-
Verify the installation:
brew doctor