1

In Ubuntu, whever I run into a permissions error I just run the command as sudo at it usually works. Not the case in OSX:

$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
 From https://github.com/Homebrew/homebrew
 * [new branch]      master     -> origin/master
error: unable to unlink old 'Library/Aliases/0mq' (Permission denied)

as sudo:

$ sudo ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
-e:69: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Don't run this as root!

Not sure what I should be doing. I run into this sort of thing all the time and while I could sudo chown the relevant directories I will be doing that all the time.

I can't sudo brew install either as brew 'cowardly refuses' to operate as a super user. I'm just confused because I feel like I'm attempting to do something stupid, and yet the Ubuntu equivalent of this, sudo apt-get install is considered the correct way to install new applications?

I could also create a new user who is actually a super user and install things as him, but Ubuntu doesn't let you do this as it's a bad idea and I agree having a user with limited abilities and sudoing only when needed seems like a much better idea.

1 Answer 1

1

/usr/local/ should not be world writable; that's a bad thing - and the error/warning message is quite right to point it out. (I wonder how it got that way in the first place ?)

Also, you don't always have to resort to chown'ing directories - you should consider user/group ownerships and permissions as pieces of the same puzzle.

In this case, I suggest you remove the world write bit from /usr/local and try again.

sudo chmod o-w /usr/local

EDIT:

I found this in the script you are trying to run.

This script requires the user #{ENV['USER']} to be an Administrator. If this
sucks for you then you can install Homebrew in your home directory or however
you please; please refer to our homepage. If you still want to use this script
set your user to be an Administrator in System Preferences or `su' to a
non-root user with Administrator privileges.

Therefore I'd suggest you add yourself temporarily as an administrator. I think this probably just adds you to the admin group. If so, you could also make /usr/local (and any other subdirs thereof) group owned/writable by anyone in the admin group.

sudo chgrp admin /usr/local
sudo chmod g+w /usr/local

This would be much more acceptable from a security point of view than blanket changes. I've seen some "solutions" where people chown the entire /usr/local contents to their own id.

Tut tut tut.

Or the other way (as the above suggests) it to install as non-root into a home directory somewhere.

1
  • But then I get Warning: It appears you have MacPorts or Fink installed. Software installed with other package managers causes known problems for Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again. Error: Could not create /usr/local/Cellar Check you have permission to write to /usr/local
    – Starkers
    May 8, 2014 at 10:33

You must log in to answer this question.

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