I followed the simple instructions on Homebrew's homepage:

Paste this at a terminal prompt:
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"

But I get the following permission errors. What is the proper way to install Homebrew on Mac OS X Lion?

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
==> This script will install:

Press enter to continue
==> /usr/bin/sudo /bin/chmod o+w /usr/local
mkdir: /usr/local/Cellar: Permission denied
mkdir: /usr/local/etc: Permission denied
mkdir: /usr/local/include: Permission denied
mkdir: /usr/local/lib: Permission denied
mkdir: /usr/local/Library: Permission denied
mkdir: /usr/local/sbin: Permission denied
mkdir: /usr/local/share: Permission denied
mkdir: /usr/local/var: Permission denied
mkdir: /usr/local/.git: Permission denied
Failed during: /bin/mkdir /usr/local/Cellar /usr/local/etc /usr/local/include /usr/local/lib /usr/local/Library /usr/local/sbin /usr/local/share /usr/local/var /usr/local/.git

Try this: sudo /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)".

  • I think that would've worked, I was reluctant to because I didn't want to mess with Homebrew's mechanism for enabling non-sudo required installs. The problem seemed to be that Homebrew added o+w permission to /usr/local, but OS X Lion's main user is part of the group of /usr/local, so adding g+w worked. I assume I can now safely remove with sudo chmod g-w /usr/local? – at01 Aug 4 '11 at 9:29
  • I have to admit I just posted a knee-jerk "Permission issue, try sudo" answer. I don't actually know the answer, but I presume you could indeed try that :) – Zsub Aug 4 '11 at 9:35

I just struggled with the same problem, but instead of manually entering any commands, I used gist: 768518 to do the dirty stuff for me. Worked like a charm—and you won't need any sudoing!

The aforementioned gist (aptly described as "Fix permissions on /usr/local for Homebrew") only fixes the permissions, i.e. it doesn't install Homebrew despite the fact it is a fork of the installation script.

†) other than the required $ chmod a+x fix_homebrew.rb and $ ./fix_homebrew.rb of course


Github has a beautiful app for Mac that eliminates the painful commandline process (if the commandline is not your thing that is ;-))

  • 3
    It would be rather contradictory, though, if one wishes to install Homebrew while command-line not being his "thing" :-D – Jari Keinänen Sep 23 '11 at 17:35
  • How would GitHub for Mac help with installing Homebrew? – Daryl Spitzer Aug 9 '13 at 18:58

try these, these works for me..

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
  • mxcl/homebrew repo is now homebrew/homebrew – konqui Dec 19 '13 at 19:04

the official oneliner from brew.sh is this...

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

why would you like to use a outdated gist version and not the original script???

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .