Reputation: 2191
I was installing the starship via homebrew, but I am getting this error:
Permission denied @ apply2files - /usr/local/lib/node_modules/expo-cli/node_modules/extglob/lib/.DS_Store
Any solution for fixing this error?
Thanks.
Upvotes: 209
Views: 145572
Reputation: 41
For latest version of MacOS, I cannot use *
to match subdirectories' patterns, zsh reports error:
➜ ~ sudo chown -R $(whoami):admin /usr/local/* \
&& sudo chmod -R g+rwx /usr/local/*
chown: /usr/local/*: No such file or directory
So instead, you can simply use ls to find subdirectories and send to chown
:
cd /usr/local
sudo chown -R $(whoami):admin `ls` \
&& sudo chmod -R g+rwx `ls`
Wait for a while and the operation shall succeed.
Upvotes: 1
Reputation: 19
In my case it worked with:
sudo chown -R $(whoami) /usr/local/lib/python3.11/*
Upvotes: 0
Reputation: 301
I had the same problem, and the solutions suggested didn't fix it. I had to change the ownership of homebrew folder and subfolders
sudo chown -R $(whoami) /opt/homebrew/*
Upvotes: 20
Reputation: 1956
for me, the issue was with the permission of homebrew while cleaning the old packages brew cleanup
sudo chown -R ${LOGNAME}:staff /opt/homebrew/lib/
Upvotes: 2
Reputation: 611
If you are getting the above error during brew cleanup “Permission denied @ apply2files”, one of the solutions which worked in my case was to reset permissions to /usr/local
. You will have to rewrite permission to the current user. In your terminal copy and paste:
sudo chown -R $(whoami):admin /usr/local/* \
&& sudo chmod -R g+rwx /usr/local/*
Then rerun the command. The permission error should go.
Hope it may help someone in the future. Good luck
Upvotes: 60
Reputation: 9240
This issue appeared after upgrading macOS to Mojave 10.14.X onwards.
Therefore, you need to reset the permissions in /usr/local:
sudo chown -R $(whoami):admin /usr/local/* \
&& sudo chmod -R g+rwx /usr/local/*
Source: https://github.com/Homebrew/homebrew-core/issues/45009#issuecomment-543795948
Upvotes: 405
Reputation: 149
what worked for me, simply delete the directory with
sudo rm -rf %error file path%
Upvotes: -1
Reputation: 920
In my case, It works with
sudo chown -R douglas.mesquita:admin /usr/local/lib/node_modules
Upvotes: 0
Reputation: 10388
This work for me.
Remove and reinstall brew
.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Upvotes: 0
Reputation: 31
first
sudo chown -R $(whoami):admin /usr/local/* \
&& sudo chmod -R g+rwx /usr/local/*
the reinstall all the packages with
brew list --formula | xargs brew reinstall
this part may take few minutes but worked great for me
Upvotes: 3
Reputation: 26727
You can change owner by :
sudo chown -R ${LOGNAME}:staff /usr/local/lib/node_modules
Upvotes: 143
Reputation: 2807
Change permission of the node_modules directory by running
sudo chown -R ${LOGNAME}:staff /usr/local/lib/node_modules
Upvotes: 2
Reputation: 51
You can run the command:
sudo chmod 755 /usr/local/lib/node_modules/expo-cli/node_modules/extglob/lib/.DS_Store
Upvotes: 1