/~r/sysadmin/ Have you tried turning it on and off again?

fuse-zip fails to install via homebrew on OS X 10.11

The gist of the problem is that brew install fuse-zip shows me something like this on OS X 10.11:

ar -cr libfusezip.a bigBuffer.o extraField.o fileNode.o fuse-zip.o fuseZipData.o
clang++ main.o -Xlinker -L/usr/local/libinstall -Llib -lfusezip -L/usr/local/lib -losxfuse -pthread -liconv  -L/opt/boxen/homebrew/Cellar/libzip/1.0.1/lib -lzip -lz  \
	    -v -o fuse-zip
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.11.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -w -o fuse-zip -Llib -L/opt/boxen/homebrew/Cellar/libzip/1.0.1/lib -L/opt/boxen/homebrew/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries main.o -L/usr/local/libinstall -lfusezip -losxfuse -liconv -lzip -lz -headerpad_max_install_names -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/lib/darwin/libclang_rt.osx.a
ld: library not found for -losxfuse
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Root causes

  • I’m using /opt/boxen/homebrew as my homebrew root, since I’m also using Boxen.
  • In newer versions of OS X, the osxfuse package must be installed via Homebrew Cask, because of the ban on unsigned kexts.
  • The Cask version of osxfuse will install its libraries, includes, and binaries to /usr/local regardless of where the user’s homebrew directory is.
  • Notice that /usr/local/lib is not included in any of the library paths in the ld invocation show before.

Since all the libosxfuse stuff is in /usr/local/lib, it is not being found by the linker. After many unsuccessful attempts at doing this The Proper Way™, I gave up.

My current workaround/solution:

cd /opt/boxen/homebrew/lib  # Replace with your actual homebrew lib directory
cp -i -R /usr/local/lib/ ./.

Now fuse-zip “works”. Yay.