Installing sshfs on macOS 12 via Homebrew

· 2 min read

Quick note on getting sshfs installed on an Intel Mac still on macOS 12 (Monterey), since Homebrew no longer ships a pre-built bottle for it on this OS version and the build failed in a non-obvious way.

Starting point

  • macOS 12.7.6, Intel (x86_64)
  • macFUSE was already installed (brew info macfuse showed Installed (on request)), so the usual “enable the kernel extension in System Settings → Privacy & Security” step was already done.
  • Homebrew’s core sshfs formula doesn’t build the macOS client; the community tap gromgit/fuse provides it as sshfs-mac.

The straightforward attempt (failed)

brew install gromgit/fuse/sshfs-mac

No bottle exists for this configuration (only arm64_tahoe / arm64_sequoia bottles are published), so Homebrew fell back to building sshfs 3.7.6 from source via meson. It failed with:

Found pkg-config: YES (.../shims/mac/super/bin/pkg-config) 3.0.6
Run-time dependency fuse3 found: NO  (tried pkg-config and framework)

meson.build:48:15: ERROR: Dependency "fuse3" not found (tried pkg-config and framework)

Diagnosing it

pkg-config --modversion fuse3 worked fine directly in a normal shell (3.18.2, .pc file at /usr/local/lib/pkgconfig/fuse3.pc, installed by the macFUSE cask). So the library was there — the build sandbox just couldn’t see it.

Homebrew’s sshfs-mac formula depends on a shared MacfuseRequirement helper (Homebrew/os/mac/pkgconfig/fuse require file) that does:

env do
  ENV.append_path "PKG_CONFIG_PATH", HOMEBREW_LIBRARY/"Homebrew/os/mac/pkgconfig/fuse"
end

That directory is expected to hold fuse.pc / fuse3.pc files (or symlinks to the real macFUSE ones) so Homebrew’s sandboxed build environment (which strips ordinary PKG_CONFIG_PATH for build purity) can still find them. On this Homebrew install the directory didn’t exist at all:

$ ls /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/fuse
No such file or directory

Exporting PKG_CONFIG_PATH in the outer shell before calling brew install, or setting HOMEBREW_NO_SANDBOX=1, made no difference — Homebrew’s superenv resets PKG_CONFIG_PATH and only trusts what the formula itself appends.

The fix

Recreate the missing shim directory and point it at the real macFUSE .pc files:

HL=/usr/local/Homebrew/Library
mkdir -p "$HL/Homebrew/os/mac/pkgconfig/fuse"
ln -sf /usr/local/lib/pkgconfig/fuse.pc  "$HL/Homebrew/os/mac/pkgconfig/fuse/fuse.pc"
ln -sf /usr/local/lib/pkgconfig/fuse3.pc "$HL/Homebrew/os/mac/pkgconfig/fuse/fuse3.pc"

Then retry:

brew install gromgit/fuse/sshfs-mac

This time meson setup found fuse3 immediately and the build finished in about 9 seconds:

🍺  /usr/local/Cellar/sshfs-mac/3.7.6: 10 files, 153.8KB, built in 9 seconds

Verified with:

$ which sshfs
/usr/local/bin/sshfs
$ sshfs --version
...
SSHFS version 3.7.6
FUSE library version 3.18.2
using FUSE kernel interface version 7.45

Caveat

That symlink fix lives inside Homebrew’s own Library tree, so a future brew update could wipe it out — if sshfs-mac ever needs reinstalling/upgrading from source again on an unsupported macOS version, the same fix will likely be needed again.