Installing Homebrew without admin privileges

Sarthak Agrawal
2 min readJan 25, 2022

Introduction

It is very common for offices and schools to issue MacBooks for professional and/or personal use, but these computers are oftentimes heavily restricted so much so that I found it practically impossible to install coding packages I needed for projects.

At first, I attempted to find crazy workarounds for things I needed to install. Of course, I could request it, but that can take multiple days for the request to be processed and approved and I didn’t want to wait that long.

Eventually, I discovered Homebrew, and saw that it could install everything that I needed to install without using admin privileges. The issue was that Homebrew itself required admin privileges to install. After doing some googling and searching through their docs, I found a way to install Homebrew without admin

Steps

First, I cloned Homebrew’s code:

git clone --depth=1 https://github.com/Homebrew/brew ~/Documents/.brew

Next, I ran the following command in the terminal to open up the zsh shell config file:

nano ~/.zshrc

This would open up your .zshrc file (which might be blank) in terminal. Then, I pasted the following line:

export PATH="$HOME/Documents/.brew/bin:$HOME/Documents/.brew/sbin:$PATH"

Pasting this allows you to access Homebrew with terminal commands i.e we are setting the path for where the executable directory of Homebrew is located.

To save the changes, I didCtrl^X, y, and then hit enter. This brings me back to terminal, where I ran the final command:

source ~/.zshrc

This refreshes the config files that you just changed, so now you can type in brew in the terminal and hit enter and it will work. It may install somethings and set somethings up which could take a while.

That’s all. While my use case for a admin-free brew was because of student restrictions, there are plenty of other reasons you may need to install brew without admin privileges and I hope this helps.

--

--