How to Mount a Filesystem via SSH on OSX Mountain Lion

If you find yourself with remote development environments, but prefer working on your local mac, you may find some joy with mounting the remote filesystem over ssh. This way you can access it as if it were a native set of files.

Install OSXFUSE

This is the successor to the MacFuse software that allowed this in the past. The steps I followed are:

  1. Download the package: https://github.com/osxfuse/osxfuse/downloads
  2. Install the package.
  3. Restart your computer as recommended.

Install SSHFS

To take care of mounting the file system you will need sshfs, which can be installed effortlessly with homebrew, which you certainly should be using.

brew install sshfs

Mounting a Remote System

First create a location for your mount, I placed mine in my default development directory:

mkdir -pv ~/development/sshfs-mount

Assuming you have your ssh keys set up already it will be a simple matter of running:

sshfs your.remote.system.com:/ ~/development/sshfs-mount

Of course replacing your.remote.system.com with, well, your remote system. You can mount a specific folder after the :. The above mounts the root directory, while leaving it off mounts the home directory.

Enjoy this article? Read more like it in the Devops category.