Can I install Homebrew without sudo privileges? - Super User most recent 30 from 2019-03-25T11:49:35Z 24 Can I install Homebrew without sudo privileges? BenjaminGolder 2013-07-14T00:22:54Z 2019-02-27T23:16:40Z <p>Homebrew nicely allows package installations without sudo privileges, but it seems that I need admin privileges to install Homebrew itself.</p> <p>I'd like to install Homebrew in a Mac environment where I don't have sudo or admin privileges. Is this possible?</p> 11 Answer by David Hoelzer for Can I install Homebrew without sudo privileges? David Hoelzer 2013-07-14T01:14:34Z 2013-07-14T01:19:22Z <p>No.. Unless you do significant surgery.</p> <p>The reason is that Homebrew strongly insists on installing packages into <code>/usr/local</code>. In fact, even if you forced it to install somewhere else, you are likely to break dependencies when you use <code>brew install</code> to install packages. Most if not all of these packages are pre-compiled and linked expecting to live in <code>/usr/local</code>.</p> <p>The reason for this insistence is that <code>/usr/local</code> is precisely where POSIX recommends that stuff like this gets installed. In order to create <code>/usr/local</code> Homebrew needs temporary admin credentials to create the directory and assign ownership. </p> <p>This, in turn, is what allows you to install anything else without elevating credentials.</p> 15 Answer by Skylar Saveland for Can I install Homebrew without sudo privileges? Skylar Saveland 2015-02-23T23:34:33Z 2016-01-07T23:55:17Z <p>Yes.</p> <p>I modified the install script to not use <code>sudo</code> and to use a directory of your choice. <a href="" rel="noreferrer"></a></p> <p>Download that, set <code>YOUR_HOME</code> in the script to the absolute path. <code>chmod +x</code> the script. Create the <code>YOUR_HOME/usr/local</code> directory. Then, execute the script.</p> <pre><code>./install.rb </code></pre> <p>In <code>.bash_profile</code>, I set (I'm not positive this is important, pretty sure):</p> <pre><code>export HOMEBREW_PREFIX=/The/path/to/YOUR_HOME/usr/local </code></pre> <p>Now, I can:</p> <pre><code>brew install wget </code></pre> <p>Make sure the <code>bin</code> directory, <code>YOUR_HOME</code> + <code>/usr/local/bin</code> is on your <code>$PATH</code>.</p> <pre><code>which wget </code></pre> 0 Answer by eel ghEEz for Can I install Homebrew without sudo privileges? eel ghEEz 2018-07-13T01:20:50Z 2018-07-13T02:02:05Z <p>Yes.</p> <p>The brew system appears bootstrappable</p> <pre><code>#!/bin/bash set -ex export HOMEBREW_PREFIX=~/homebrew # export HOMEBREW_NO_ANALYTICS=1 mkdir -p "${HOMEBREW_PREFIX}" curl -fsSLk | tar xz --strip 1 -C "${HOMEBREW_PREFIX}" ls -laR "${HOMEBREW_PREFIX}" export PATH="${HOMEBREW_PREFIX}/bin:${PATH}" type -a brew type -a openssl || : openssl version -a || : type -a curl || : curl -V || : # Fails to lock a .git/config file. ##brew analytics off # No "brew update" until installing the proper openssl and a curl that uses it. # brew update # brew remove openssl || : brew install openssl brew link --force openssl # brew remove curl || : brew install --with-openssl curl brew link --force curl || : curl -V ls -la "${HOMEBREW_PREFIX}/opt" ls -la "${HOMEBREW_PREFIX}/bin" ls -laLR "${HOMEBREW_PREFIX}/opt/curl/" </code></pre> 0 Answer by Astik Anand for Can I install Homebrew without sudo privileges? Astik Anand 2018-09-24T06:21:56Z 2018-09-24T06:21:56Z <p>To install <strong>homebrew without sudo</strong>.</p> <pre><code>git clone echo 'export PATH="/path/to/cloned_folder/homebrew/bin:$PATH"' &gt;&gt; ~/.bash_profile </code></pre> <p><strong>Restart terminal</strong> and run </p> <pre><code>brew --version </code></pre> 0 Answer by Maksim for Can I install Homebrew without sudo privileges? Maksim 2019-02-27T23:16:40Z 2019-02-27T23:16:40Z <p>No longer works with newer version of Brew</p>