Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If installed using Homebrew, ruby-install errors because sudo installs are no longer allowed #291

Open
jeremy-hanna opened this issue Jan 25, 2017 · 7 comments
Labels

Comments

@jeremy-hanna
Copy link

jeremy-hanna commented Jan 25, 2017

Env:

  • mac OS X: 10.12.2
  • Homebrew: 1.1.8
  • ruby-install: 0.6.1

screen shot 2017-01-25 at 5 11 25 pm

As of Nov 1st, it appears that homebrew added this restriction: here

sudo -u "$brew_owner" brew install "$@" ||
sudo -u "$brew_owner" brew upgrade "$@" || return $?

@jeremy-hanna
Copy link
Author

jeremy-hanna commented Jan 25, 2017

My temp fix:

  • downloaded the source and make installed it - failed in the same fashion
  • removed sudo -u "$brew_owner" from the two lines linked above and make installed it - failed for permissions
  • sudo make install built it and works

Probably because this /usr/bin/stat -f %Su "$(command -v brew)")" evaluates to root based on my system install

@jeremy-hanna
Copy link
Author

jeremy-hanna commented Jan 25, 2017

I guess this is more environment configuration than a bug with ruby-install, would it make sense to have a warning thrown if $brew_owner is ever root?

@josephholsten
Copy link

josephholsten commented Feb 8, 2017

the problem for me is that

$ ls -l /usr/local/bin/brew
lrwxr-xr-x  1 root  wheel  28 Jan  4 14:03 /usr/local/bin/brew -> /usr/local/Homebrew/bin/brew

/usr/local/Homebrew/bin/brew has myself as its owner.

@jpickwell
Copy link

http://docs.brew.sh/Troubleshooting.html

@josephholsten, from that page try running

cd /usr/local && sudo chown -R $(whoami) bin etc include lib sbin share var Frameworks

I prefer:

sudo chown -R $(whoami) /usr/local

I'm not sure what causes it, but sometimes the /usr/local directory becomes owned by root.

@havenwood havenwood added the macos label Jun 8, 2017
@flvrone
Copy link

flvrone commented Nov 25, 2019

@havenwood it's not macOS-only anymore, as Homebrew is officially supported on Linux too now.
I have it installed on my Solus, as I needed to install something with it, and now have the same issue.
However, I can use --no-install-deps to skip that step, and move on as usual.

@havenwood havenwood added brew and removed macos labels Nov 25, 2019
@postmodern
Copy link
Owner

Is this still an issue? 0.8.2 added better logic for when and when-not-to use sudo with brew. See 093608a

@phantomwhale
Copy link

I did manage to get this a couple of times; this last time, first time on an M2 macbook, for some reason, /opt/homebrew/bin/brew was a symlink to /opt/homebrew/Homebrew/bin/brew, and whilst my user owned the latter, target executable, the symlink was marked as owned by root, which made ruby-install attempt sudo -u root .... for it's commands

Fixing the symlink removed the issue, but wanted to note it here in case it helps others. Or me, in 4-6 months time, most likely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants