I got homebrew installed, however I do not have admin access. How do I install homebrew packages without admin access? Is there a local tag or something that I keep missing?
4 Answers
Homebrew needs /usr/local
to be chown
-ed to your user, and you need sudo
for that. If you can’t you have to install it elsewhere. Some people use ~/.brew
or ~/homebrew
; you can use anything but avoid paths with spaces. See the docs here.
Let’s say you want to install in ~/.brew
; run the following command:
git clone --depth=1 https://github.com/Homebrew/brew ~/.brew
Then ensure the bin
and sbin
directories are in your PATH
. If you’re using Bash add the following in your ~/.bash_profile
:
export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$PATH"
Run source ~/.bash_profile
or restart your shell and run brew doctor
to see if it’s installed correctly. It should warn you it’s not installed into /usr/local
but that’s expected here.

- 18,169
- 13
- 73
- 107
-
2I just want to add that, to make this work I had to run `brew update` first! – spicypumpkin May 12 '17 at 15:58
-
We ran this when the current version of brew was 2.1.4. These instructions yielded brew v1.7.x, which we easily `brew upgrade`d immediately. No sudo required! We did have to manually add the location of brew to the `PATH`, which is not mentioned). – Tom May 28 '19 at 20:12
-
Currently, the docs provided for [homebrew (legacy)](https://github.com/Homebrew/legacy-homebrew/blob/master/share/doc/homebrew/Installation.md#alternative-installs) is now outdated. ([last commit](https://github.com/Homebrew/legacy-homebrew/blob/15f291ddaa05cc010456a733b799382175c29dd4/share/doc/homebrew/Installation.md#alternative-installs)) See the new [updated link](https://github.com/Homebrew/brew/blob/master/docs/Installation.md#alternative-installs) ([commit](https://github.com/Homebrew/brew/blob/3f64bcb2fbffc663be53b1739c1e6009be9db055/docs/Installation.md#alternative-installs)) – Jun 04 '21 at 17:17
To install homebrew without sudo.
git clone https://github.com/mxcl/homebrew.git
echo 'export PATH="/path/to/cloned_folder/homebrew/bin:$PATH"' >> ~/.bash_profile
Update the
/path/to/cloned_folder
with the path of the homebrew cloned folder.
Restart terminal and run
brew update
brew --version

- 12,757
- 9
- 41
- 51
-
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo. – WilliamK Mar 26 '20 at 02:08
-
But running OSX as the root user gets things moving, such as viewing and agreeing to the software licence. – WilliamK Mar 26 '20 at 02:23
-
-
@WilliamK, folder path is where you have done the git clone of hombrew. I mean that much you have think from your side. – Astik Anand Mar 26 '20 at 04:48
git clone https://github.com/Homebrew/brew
pwd
echo 'export PATH="*RESULT_OF_PWD*/brew/bin:$PATH"' >> ~/.bash_profile

- 41
- 1
if it's for programming/building purposes you could also is easy to download the formula, extract the download url, and unzip it in your prefix (is your local folder): it's json https://formulae.brew.sh/api/formula/gtk+3.json

- 6,799
- 1
- 32
- 24