Permission denied @ apply2files - /usr/local/lib/node_modules/expo-cli/node_modules/extglob/lib/.DS_Store?

Macos

Macos Problem Overview


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.

Macos Solutions


Solution 1 - Macos

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

Solution 2 - Macos

You can change owner by :

sudo chown -R ${LOGNAME}:staff /usr/local/lib/node_modules

Solution 3 - Macos

If you are getting the above error during brew cleanup “Permission denied @ apply2files”, one of the solution which worked in my case was to reset permissions to /user/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 future. Good luck

Solution 4 - Macos

Change permission of the node_modules directory by running

sudo chown -R ${LOGNAME}:staff /usr/local/lib/node_modules

Solution 5 - Macos

You can run the command: sudo chmod 755 /usr/local/lib/node_modules/expo-cli/node_modules/extglob/lib/.DS_Store

Solution 6 - Macos

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

Solution 7 - Macos

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)"

Solution 8 - Macos

In my case, It works with

sudo chown -R douglas.mesquita:admin /usr/local/lib/node_modules

Solution 9 - Macos

what worked for me, simply delete the directory with

sudo rm -rf %error file path%

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKishore SView Question on Stackoverflow
Solution 1 - MacosJerry ChongView Answer on Stackoverflow
Solution 2 - MacosPhilippeView Answer on Stackoverflow
Solution 3 - MacosManoj DaswaniView Answer on Stackoverflow
Solution 4 - MacosMilind PatelView Answer on Stackoverflow
Solution 5 - MacosCui YangView Answer on Stackoverflow
Solution 6 - MacosChabrol DavidView Answer on Stackoverflow
Solution 7 - MacosGuptaView Answer on Stackoverflow
Solution 8 - MacosDouglas MesquitaView Answer on Stackoverflow
Solution 9 - MacosPrimeDimeView Answer on Stackoverflow