How to fix the error Permission denied @ apply2files - /usr/local/lib/node_modules/expo-cli/node_modules/extglob/lib/.DS_Store?
This issue is appeared after upgrading macOS to Mojave 10.14.X onwards.
Therefore, you need to resetting 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
You can change owner by :
sudo chown -R ${LOGNAME}:staff /usr/local/lib/node_modules
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