33

Homebrew: Permissions Denied Issue Fix (OS X / macOS)

 1 year ago
source link: https://gist.github.com/irazasyed/7732946
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Homebrew: Permissions Denied Issue Fix (OS X / macOS)

Homebrew Permissions Denied Issues Solution

sudo chown -R $(whoami) $(brew --prefix)/*

BradleyRan commented on Mar 19, 2021

edited

sudo chmod g+w /usr/local/share/zsh/site-functions/

Life. Saved.

sudo install -d -o $(whoami) -g admin /usr/local/Frameworks

@pointum thank you so much !

mollet7 commented on May 8, 2021

edited

Thank it work for me "sudo install -d -o $(whoami) -g admin /usr/local/Frameworks"

I got permission issues when upgrading my brews.

Since brew installs into /opt/homebrew/ now instead I did the following to correct the issue sudo chown -R $(whoami):staff /opt/homebrew/ and my permission issues resolved. smiley

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

Thank you

Excelent!, thanks

worked, thanks

AbrantesMar commented on Jul 31, 2021

edited

my solution with link: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

and command: sudo chown -R "$(whoami)":admin /usr/local

it ":admin" for sum in user

MacOS BigSur 11.4

Worked for me, thank you very much!

Before t looked like:

after upgrading to High Sierra, uninstall brew & re-install with the below command to ensure the linking to the brew github and associated permissions to the local folder work correctly:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

For real? Didn't work as expected at all on macOS Catalina...
How come reinstalling fixed the problem?
I still winded up having the same permission denial.

my solution with link: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

and command: sudo chown -R "$(whoami)":admin /usr/local

it ":admin" for sum in user

MacOS BigSur 11.4

Chances are it's your sudo chown bit that saved you
Reinstallation probably was never part of the equation

Is there a safe solution for my scenario?
All the clients (Macs) are in a network where all the users are logged through AD on a Windows server. Every machine has its admin user. How can I get rid of permission errors in this environment? I wouldn't like to mess up by giving permissions to these network users, they are managed as they should by other softwares and systems, such as the AD and the Avid managers (Interplay and NEXIS).
TiA

No need to chown the whole /usr/local if brew only fails to create a single directory.

For example, I fixed this error:

Permission denied @ dir_s_mkdir - /usr/local/Frameworks

With this command:

sudo install -d -o $(whoami) -g admin /usr/local/Frameworks

Thanks -- it's work for me

my solution with link: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
and command: sudo chown -R "$(whoami)":admin /usr/local
it ":admin" for sum in user
MacOS BigSur 11.4

Chances are it's your sudo chown bit that saved you Reinstallation probably was never part of the equation

@Qlub53 I first did the sudo chown part, didn't work, I then proceeded to reinstall, and my problems were gone :)

Thanks @aether2501

"sudo chown -R $(whoami) $(brew --prefix)/*"
Worked just fine for me. But can Anyone explain why there's people saying that this is a terrible solution and that they are going to Macports?

Trying to run a brew cleanup, I kept getting errors like this one, exclusively with .DS_Store files:

Error: Permission denied @ apply2files - /usr/local/lib/prey/versions/1.9.12/node_modules/sqlite3/lib/.DS_Store

Ended up using simply:

cd /usr/local/lib/
sudo find . -name ".DS_Store" -delete

And the next brew cleanup ran fine.

Thanks!!! @mihkell
It works for MacOS BigSur 11.4

Well I ran this command:

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

as well as:

chmod u+w /usr/local

And now I regret it. It's a security faux pas for the reasons others have said.

How do I change the ownership and permissions of /usr/local (and all subfolders and their contents) back to the factory defaults?

I'm running High Sierra.

Many thanks.

Here's what I did to force Homebrew to run as root:
cd /usr/local/Homebrew/Library/Homebrew
Edit brew.sh, look for "Running Homebrew as root is extremely dangerous and no longer supported" (line 250 in my version), delete the check.

Did exactly that by temporary just returning in function check-run-command-as-root() in /usr/local/Homebrew/Library/Homebrew/brew.sh. Worked (some symlink related problems got fixed) and changed back. No more problems since then.

Worked on Monterey.

Was getting

Error: Could not cleanup old kegs! Fix your permissions on:
  /usr/local/Cellar/[email protected]/7.4.16
  /usr/local/Cellar/[email protected]/7.4.24

wooooow <3

I'm really expected to recursively change ownership of my entire usr/local directory just because Homebrew told me to? A directory shared by all sorts of other applications and services? Ridiculous

rtfmoz2 commented on Apr 4

edited

Homebrew needs to work with the systems it is installing itself on. If there are permission issues then it needs to suggest sudo commands to the user that cover its specific requirements. Better yet provide a script for users to run under sudo to pre-create the dirs set permissions prior to install.

The closest I could come up with is the following. This make use of the users default group setting so other users can install homebrew utilities as well. Replace $GID if you want to use a different group, admin is a common one.

for name in Cellar Cask Homebrew Frameworks; do [ ! -d $name ] && sudo install -d -g $GID -m 0775 /usr/local/$name; done

omego commented on Apr 12

Thank you!

erma4ina commented on Apr 19

Was getting

erma4inapower@MacBook-Pro-Dmitrij  ~  brew services start php
Error: Permission denied @ rb_sysopen - /Users/erma4inapower/Library/LaunchAgents/homebrew.mxcl.php.plist

Ended up:

sudo chown -R $(whoami) /Users/erma4inapower/Library/LaunchAgents/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK