Mount SSHFS on OS X

If you want to have a fast and secure method to work with filesystem on remote machine that has only SSH you can choose SSHFS.

Installing SSHFS on OS X Yosemite is easy — use Homebrew to install OSXFuse and SSHFS:

brew install Caskroom/cask/osxfuse
brew install sshfs

Use this command to mount root volume of remote host (remotehost:/) to your local folder /Users/me/host and also create a volume with name LocalVolumeName. It will automagically reconnect on network fails and SSH timeout.

sshfs user@remotehost:/ /Users/me/host/ -o reconnect,follow_symlinks,volname="LocalVolumeName"

You will be asked for a password of the remote system and if you don’t want do enter that password each time you can setup SSH passwordless login.

To get your remote filesystem faster you can create simple BASH script:

#!/bin/bash
sshfs user@remotehost:/ /Users/me/host/ -o reconnect,follow_symlinks,volname="LocalVolumeName"

Save that as sshfs.sh and give it execute permission:

chmod +x ./sshfs.sh

After that you can launch your script from Terminal or Finder.
Actually, you can name it as you want (even DestroyEarth).

  • http://ahmetalpbalkan.com/ Ahmet Alp Balkan [ahmetb@MSFT]

    I am getting package not found error from “brew install sshfs” and there are two taps: “homebrew/fuse/sshfs” and “Caskroom/cask/sshfs” to choose from, not sure which one will be better.

    • http://themengzor.com Alex Zavrazhniy

      Use “homebrew/fuse/sshfs”

      • http://ahmetalpbalkan.com/ Ahmet Alp Balkan [ahmetb@MSFT]

        Thanks, I suggest updating the article as well.

        • http://themengzor.com Alex Zavrazhniy

          No, my wrong.
          Use:
          brew install Caskroom/cask/osxfuse

          Exactly that I metioned in my article (read again first code quote)

          • http://ahmetalpbalkan.com/ Ahmet Alp Balkan [ahmetb@MSFT]

            @TheMengzor:disqus qiuestion is not about osxfuse, it’s sshfs. :)

          • http://themengzor.com Alex Zavrazhniy

            I just installed it on my new MacBook:

            themengzor@Alex-Z-MacBook ~$ brew install Caskroom/cask/osxfuse
            ==> brew cask install Caskroom/cask/osxfuse

            🍺 osxfuse staged at ‘/opt/homebrew-cask/Caskroom/osxfuse/2.8.0’ (6 files, 8.5M)

            themengzor@Alex-Z-MacBook ~$ sshfs
            zsh: command not found: sshfs

            themengzor@Alex-Z-MacBook ~$ brew install sshfs
            ==> Installing sshfs from homebrew/homebrew-fuse

            🍺 /usr/local/Cellar/sshfs/2.5.0: 8 files, 136K, built in 17 seconds

            themengzor@Alex-Z-MacBook ~$ sshfs
            (process:16307): GLib-CRITICAL **: g_slice_set_config: assertion ‘sys_page_size == 0′ failed
            missing host
            see `sshfs -h’ for usage

  • Teofilo Sibileau

    @ahmetalpbalkan:disqus you need to tap homebrew/homebrew-fuse