Philipp's Computing Blog

Success is about speed and efficiency

SSHFS on Mac OS X 10.6.8 and 10.7.2 with Fuse4X

Fuse4X is a port of FUSE - The Filesystem in Userspace to Mac OS X and allows you to mount all different kinds of remote / local filesystems on you Mac computer. A very popular 'filesystem' is sshfs, which allows you to mount a directory of a remote server to a local mountpoint (which is also a folder). You need to have access to the remote server via SSH to make this work.

Fuse4X is a modern replacement for the old MacFUSE implementation of Fuse for Mac OS.

You can either go to the website of the project, download, double click and install the files. Or you can use the terminal (what you should be able to do anyway if you know what SSH is and how to use it).

Using the terminal: The Homebrew variant:
The most recently accepted formula to install Fuse4X via Homebrew makes it really easy to install fuse4x and sshfs:

brew install fuse4x sshfs

Using the terminal: The manual variant:
Here is how you can install it including SSHFS on the Terminal:

cd ~/Downloads
## Download the latest version (as found on fuse4x.org) and install
wget https://github.com/downloads/fuse4x/fuse4x/Fuse4X-0.8.7.pkg
open Fuse4X-0.8.7.pkg
## Get the latest version of SSHFS (as found on github.com/fuse4x/fuse4x/downloads)
wget https://github.com/downloads/fuse4x/fuse4x/sshfs-2.3.0.zip
## Install sshfs binary to /usr/local/bin/sshfs (and install man page):
unzip sshfs-2.3.0.zip -d /

Whatever method you chose, you should be able to use the sshfs command on the terminal to mount remote filesystems via SSH access now. Options for Fuse4X (and therefore also SSHFS) can be found on http://fuse4x.github.io/options.html.
Here's a quick example:

mkdir ~/mountpoint
sshfs user@some-host.net:/home/user/ ~/mountpoint -oauto_cache,reconnect,defer_permissions,negative_vncache,volname=somename

When you are finished with the remote files and folders, you can unmount the directory simply using:

umount ~/mountpoint

To uninstall Fuse4X, you may use the uninstall script uninstall.sh which has also been put into place on your machine by the installer:

sudo /System/Library/Filesystems/fuse4x.fs/Contents/Executables/uninstall.sh

To also get rid of sshfs, run:

sudo rm /usr/local/share/man/man1/sshfs.1 /usr/local/bin/sshfs

Preventing the creation of .DS_Store files on network drives mounted via SSHFS

If you use your SSHFS mount with other operating system you may not like the creation of hidden Mac OS files in the folders of your mounted share. To prevent this behaviour, the simplest way is to mount the sshfs mount with the option noappledouble. (I found this option when trying to find out, how MacFusion does this when it offers this feature for each individual sshfs share. I found its implementation here.)

Alternatively, you can tell Mac OS to not create these files on any network shares using:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

which will write this setting to the ~/Library/Preferences/com.apple.desktopservices.plist file.

To delete .DS_Store files from previous use of that share with Mac OS X, you can run the following command to recursively delete all files with this name in the directory /path/to/share:

find /path/to/share -name .DS_Store -exec rm {} \;

Resources