Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@odyssey4me
Last active December 22, 2023 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save odyssey4me/3ce1b4f08bf8ceb34b93590c11d1f91a to your computer and use it in GitHub Desktop.
Save odyssey4me/3ce1b4f08bf8ceb34b93590c11d1f91a to your computer and use it in GitHub Desktop.
Mac OS X: working around brew failing to install a cask due to a protected file in /usr/local/lib/
If you see an error like this:
% brew install macfuse
==> Caveats
macfuse requires a kernel extension to work.
If the installation fails, retry after you enable it in:
System Preferences → Security & Privacy → General
For more information, refer to vendor documentation or this Apple Technical Note:
https://developer.apple.com/library/content/technotes/tn2459/_index.html
==> Downloading https://github.com/osxfuse/osxfuse/releases/download/macfuse-4.1.2/macfuse-4.1.2.dmg
==> Downloading from https://github-releases.githubusercontent.com/1867347/bef7db00-b69c-11eb-8f46-85e4f7a57751?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210730%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210
######################################################################## 100.0%
==> Installing Cask macfuse
==> Running installer for macfuse; your password may be necessary.
Package installers may write to any location; options such as `--appdir` are ignored.
installer: Package name is macFUSE
installer: Installing at base path /
installer: The install was successful.
==> Changing ownership of paths required by macfuse; your password may be necessary.
chown: /usr/local/lib/sentinel.dylib: Operation not permitted
==> Purging files for version 4.1.2 of Cask macfuse
Error: Failure while executing; `/usr/bin/sudo -E -- /usr/sbin/chown -R -- <username>:staff /usr/local/include /usr/local/lib` exited with 1. Here's the output:
chown: /usr/local/lib/sentinel.dylib: Operation not permitted
Do this:
Edit /usr/local/Homebrew/Library/Homebrew/cask/staged.rb
Find:
@command.run!("/usr/sbin/chown", args: ["-R", "--", "#{user}:#{group}", *full_paths],
sudo: true)
Change it to:
@command.run!("/usr/sbin/chown", args: ["-f", "-R", "--", "#{user}:#{group}", *full_paths],
sudo: true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment