Homebrew install “permission denied” issue

Just a very quick reminder to the future me and anyone running into the same problem. If you somehow got the “permission denied” issue when doing any sort of “brew install”, it is much likely because your /Library/Caches/Homebrew/ is owned by a different user. You can do a

sudo chown -R `whoami` /Library/Caches/Homebrew/

and it should allow you to “brew install” normally.

Also, if you run into problems while doing “brew update”, do this:

sudo chown -R whoami /usr/local
cd /usr/local
git reset --hard origin/master

Short explanation: the default installation place for homebrew is /usr/local, and as you use your machine, this place got ‘dirty’ thanks to different sorts of permission changes, causing “brew update” to fail. Doing the above will pull the necessary updates while reseting the file permission to you as the rightful owner 🙂

Sources:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s