Cowardly refusing to `sudo brew install' #9953
Comments
|
(this is by design.) |
Thanks. Works now. |
why not make "brew install will not work with root privileges unless brew itself is owned by root." the error message? |
This reminds of the article "Writing Unmaintainable Code", a sarcastic look at the stuff programmers do to make things incomprehensible. "Much of the skill in writing unmaintainable code is the art of camouflage, hiding things, or making things appear to be what they are not." Why would they want us to really understand what is going on? They make us come to a forum like this one, so they can make us look dumb. I have been using linux for about 6 months and I just bought a Mac because I was tired of MS controlling stuff and annoyances. Over the past 2 weeks I have gained a new enemy, the mayhem and chaos that is the support for some open source software. After painfully uninstalling 2 programs from the Mac I looked around and a search of the internet brought me to Home brew to manage installs. Only to discover it too comes with errors, whose solutions lead me in a circle. issue 10234 |
So how do I assign root privileges to brew? |
The |
That's an odd and off putting error message. |
@jacknagel Well, then why should I have to change permissions on /usr/local/include? I never changed them in the first place, but I'm not allowed to |
Sigh. I'm tired of dealing with this. These are your options: (a) don't use (b) The Homebrew issue tracker is not a place to have debates about basic UNIX filesystem management. If you already have a basic understanding of these things, then you have the tools to manage Homebrew however you like at your disposal. |
+1 ditching this in favor of a useful error message. @jacknagel: I imagine you're very tired indeed - fixing the error message to include something like your comment above will help avoid these unnecessary discussions: "Refusing to run via sudo. brew should be able to write to /usr/local/Cellar without requiring root access. " or similar. |
+1 for changing the error message. |
I like the way people assumed I was making it incomprehensible on purpose. |
The error message now includes (since ages):
|
Nobody called anyone a 'dick'. LOL. Thanks for the lecture though. |
@rosssclafani This sort of argument has no place on an issue tracker so I've deleted your last two comments and will continue to delete any more you make on this issue. |
I wouldn't say that is fine. Anyone who does that is playing with fire and will get what they deserve. The reason being: Homebrew makes no attempt to drop permissions where appropriate so every action taken by It gets worse than that. Every Bottom line: don't run |
Thanks Max! Much appreciated & sorry about all the drama on this thread. |
My fault. I shouldn't have been sensitive about it, higher things are expected of me. But for the record: we'll improve anything and everything. |
I am a home brewing noob. I downloaded it less than an 30 min ago. As such, please take the information in this post with a grain of salt. Comments and suggestions would be welcome. I am making many assumptions and best guesses. I am sure that many old time brewers will be able to provide advice and improve the comments and instructions listed below. One option could be to have a brew (maybe brewer) user and perhaps even a brew (maybe brewer) group is an option for the future. With such a user and group, projects could be installed by this user/group by default. You could of course have projects installed by other users. But this could be a starting point? In the mean time. If you are seeing the message listed below and have already installed Home Brew then the steps below should get you up and running (skip the ones relating to install of home brew). I stumbled across this thread because I was not sure what to do when I saw this message and used the google to find out more. Chances are you may have also found this page in the same manor. In which case just as well I wrote something to help you out. Error: Cowardly refusing to `sudo brew install' You can use brew with sudo, but only if the brew executable is owned by root. However, this is both not recommended and completely unsupported so do so at your own risk. Hopefully, the following information will save someone some time. If you have more experiencing using Home Brew (I imagine most people who have commented on this thread will have more experience than myself) then please correct or suggest that I update the instructions below. The instructions below assume that you are a member of the 'admin' group on the system. If a future version of Home Brew sets up a 'brewer' group then I suppose it would just be a matter of adding yourself and others who will be brewing to that group.
If someone would like to copy / update this list then perhaps it could be put into the Home Brew wiki or quick help. Then I can just edit this post so that it links to that information (which could be kept upto date). |
@henri The only steps required are:
I'd be interested to understand why the rest were necessary for you. |
Even if "this is by design" it feels very uncomfortable and weird for me AS A USER to run a command using "sudo" and not being able to do so. It is a weird behavior that I did not expect as a user. |
@kirai If you want to run brew as sudo, you can chown the brew executable. We intentionally don't let brew be run as sudo otherwise, because the result will be that further non-sudo brew usage will fail. You're right that the messaging could be better, though. |
Yes, thanks @mistydemeo ! That is what I did and it works but I had to google it etc. As you say, the error message could give some clue to the user on why brew is cowardly refusing to do what I'm telling it to do ;) |
If you are not running as an administrator on the system then you will not have write access to /Applications. I have found the best way to get around all these issue when using homebrew (which is awesome software by the way) on a system which you are not normally the admin of is to simply login into an administrator account and then it all seems to work very well. Again, thank you for creating, releasing and offering all the support. It is such a great way to manage packages on OS X systems :) |
I got here because mac osx instructed me to re-run the brew install * command as sudo. The real issue was that I had just installed the xcode command line tools and had not accepted the xcode license agreement yet and that requires root. The solution is to call a simple command with xcrun (like sudo xcrun git status) and review and sign the agreement when prompted. Then you can get back to work brew installing whatever you please. |
OS X told you to run |
I wish I knew what "adjust the permissions on directories in /usr/local accordingly" meant (exactly)? To clarify my question, I noticed "mxcl" commented:
But how can these be the "only steps required" when "jacknagel" also wrote the following?
Is the answer to simply chmod 775 for any subdirectories under "/usr/local"? Is it also necessary to "chown root:admin" for all subdirectories of "/usr/local/" as "henri" was asking? As for the default "sudo brew" error message, while it explains that you may use "sudo", it also says it is not recommended (which makes sense to me). I think it would be far more helpful if the error message mentioned something about changing permissions for directories under "/usr/local", since that IS recommended... and seemingly required. Thanks all... |
|
@MikeMcQuaid : What are you supposed to do when running that command spits out a thousand lines of |
@SplashDance |
Hey thanks @MikeMcQuaid -- I'm embarrassed that the solution was so easy... |
I'm embarrassed that my first message wasn't more clear |
change owner of brew to root, which is common for files in /usr/local directory ( opposed to either /home or /Users ) sudo chown root /usr/local/bin/brew and/or add the admin group |
I think the problem stems from the installation. When brew is installed the first time using the ruby one-liner, it first refuses to do so with sudo privileges. Fair enough, so it does its thing then now the executable is owned by the user:admin. Great, next step you want to install something like irssi… so "brew install irssi" which works all up until I get "Permission denied" errors linking to perl5 in /usr/local/bin… Well how do we get around that, normally? I use "sudo !!" to re-run the command with some authority, at which I'm confronted with the refusal error. So what's happening here is a funnel process where the user has no solution after following directions to the letter —and the only documented workaround is to muck with permissions, which tosses out the user experience, compared to say, MacPorts. What's the elegant way to do this? [UPDATE] It seems a lot of the interesting wisdom is found when running brew doctor. THAT should be part of the initial install process because it identifies problems that may not be entirely obvious for console/UNIX newbies. |
On a clean install this does not happen. If you get permissions errors right off the bat, then there was already stuff installed into /usr/local, and it had different permissions.
The last thing the installer does is instruct the user to run https://github.com/Homebrew/install/blob/4afb9e930b6b8369f8d5032d6c8fb47ff997665e/install#L209-L210 |
@jacknagel I really think the installer should just |
@jacknagel Any objections to me just doing that? |
We already |
I'll try and take a look. |
@jacknagel Had another look and you're right. Apologies. |
`brew` should be run as the current user (in most cases, per Homebrew/legacy-homebrew#9953) and pdftotext is included in the xpdf brew package.
`brew` should be run as the current user (in most cases, per Homebrew/legacy-homebrew#9953) and pdftotext is included in the xpdf brew package.
`brew` should be run as the current user (in most cases, per Homebrew/legacy-homebrew#9953) and pdftotext is included in the xpdf brew package.
Got:
Is this related to #6899 ?
The text was updated successfully, but these errors were encountered: