4

I am trying to install Homebrew on Lion but keep getting an error.

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

I run the above code, which results in:

==> This script will install:
/usr/local/bin/brew
/usr/local/Library/Formula/...
/usr/local/Library/Homebrew/...

Press enter to continue
==> /usr/bin/sudo /bin/chmod o+w /usr/local
==> Downloading and Installing Homebrew...
bin/brew: Can't create 'bin/brew'
tar: Error exit delayed from previous errors.
Failed during: /bin/bash -o pipefail -c '/usr/bin/curl -sSfL https://github.com/mxcl/homebrew/tarball/master | /usr/bin/tar xz -m --strip 1'
==> /usr/bin/sudo /bin/chmod o-w /usr/local

I have seen a couple of 'answers' to this problem which basically suggest running the initial command as root. This fails with the following error:

$ sudo /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
Don't run this as root!

Any suggestions would be appreciated!

5
  • Does it only output one sudo line after you press enter? It should chmod all the relevant directories there.
    – nohillside
    Aug 13, 2011 at 16:15
  • "Homebrew": The missing package manager for OS X. "...the easiest... way to install the UNIX tools Apple didn't include. mxcl.github.com/homebrew
    – user9290
    Aug 13, 2011 at 16:26
  • The outputs quoted in my question are verbatim. Nothing has been edited/missed out. @Wheat Williams - Thanks for the link but it doesn't help.
    – dannymcc
    Aug 13, 2011 at 16:56
  • Danny, I put the link in because I had no idea what "Homebrew" is and I had to look it up. I thought that other people who read this question would have the same problem, and since your initial question did not define what "Homebrew" is, it needed clarificaton.
    – user9290
    Aug 13, 2011 at 17:27
  • Ahh I see, good idea! I'll make a mental note to do that for future questions.
    – dannymcc
    Aug 13, 2011 at 18:05

2 Answers 2

7

As per this question I ran the following command:

sudo chown -R `whoami` /usr/local

And then re-ran the homebrew command:

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

Press enter to continue
==> /usr/bin/sudo /bin/chmod o+w /usr/local
==> Downloading and Installing Homebrew...
==> /usr/bin/sudo /bin/chmod o-w /usr/local
==> Installation successful!
Now type: brew help

I hope this helps someone in future!

0

Wow - there's not much that can go wrong with this - is your user an admin user on the mac? (the id command should show 80(admin) for your user when in the terminal)

That's about the only thing I can see that would prevent the script from calling sudo.

You should see it asking you for a prompt here:

enter image description here

2
  • Yep, it prompts for the password and then I enter it and it accepts the password and moves on. I'm not sure if I'm doing it right but the results of the 'id' command are here: gist.github.com/1144169
    – dannymcc
    Aug 13, 2011 at 19:05
  • Ouch - your gist / id look fine. If you are comfortable with sudo - you might try again after sudo -s then mv /usr/local /usr/bad_local; mkdir /usr/local; chown root:wheel /usr/local; chmod 0755 /usr/local and trying again as your normal user. Somehow you don't have permissions to write into /usr/local (or somehow your path is really messed up and some basic commands are failing you)
    – bmike
    Aug 13, 2011 at 19:22

You must log in to answer this question.

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