Mounting a Filesystem via SSH on OSX Mavericks

fuse SSH’ing to a server and doing all the configuration through terminal is easy and very fast, but when you want to edit files and set a remote development environment on your local machine, mounting a remote filesystem over ssh and editing them as the files were in your computer is the way to go.

Right now I’m using the just released OSX Mavericks (OSX 10.9), so for mounting a remote system you will need to do some tricks and tweaks to have it working. I will try to explain step-by-step on how to do it.

Install OSXFUSE

First of all, you will have to install OSX Fuse, the successor of the MacFuse software. You would normally check in it’s GitHub Page, but the problem is that the last version released there is the 2.5.4 (as for the time I write this post) which is not compatible with this OSX, so we will need the 2.6.0.

Install SSHFS

  • If you don’t already have Brew installed, go to http://brew.sh/ and install it.
  • With Brew installed, run in Terminal:
    brew install sshfs
  • If you get an error like “Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.” all you have to do it to open Xcode and accept the agreement and wait it to install the last patches.
  • Next error that must be fixed is that XCode still uses SDK for 10.8 instead of 10.9. If you get an error saying “xcodebuild: error: SDK “macosx10.9” cannot be located.“, you will need to edit the fuse4x-kext.rb located at /usr/local/Library/Formula/fuse4x-kext.rb:

    Replace on line 21:

    macosx#{MacOS.version}” with “macosx10.8“,

    while keeping line 24 (MACOSX_DEPLOYMENT_TARGET) the same.

  • After installation, Brew will display a message saying “In order for FUSE-based filesystems to work, the fuse4x kernel extension must be installed by the root user:“, so just execute this two lined:

    sudo /bin/cp -rfX /usr/local/Cellar/fuse4x-kext/0.9.2/Library/Extensions/fuse4x.kext /Library/Extensions

    sudo chmod +s /Library/Extensions/fuse4x.kext/Support/load_fuse4x

After doing all this you should be able to mount any remote filesystem via SSH.

To create the path where you want to mount your filesystem:
mkdir -pv ~/path/to/mount

And finally mounting the system:
sshfs -C -p PORT user@server:/ ~/path/to/mount

and you are set!

Any questions, just ask!

Comments

  1. Any idea about libgthread-2.0.0.dylib missing even though brew gave (apparently) no errors?

    ~~~~~~~~~~~~~~~

    /usr/local/Cellar/sshfs/2.5.0/bin
    >./sshfs

    dyld: Library not loaded: /usr/local/lib/libgthread-2.0.0.dylib

    Referenced from: /usr/local/Cellar/sshfs/2.5.0/bin/./sshfs

    Reason: image not found

    Trace/BPT trap: 5

    1. here’s what i did to solve this:

      sudo ln -s /usr/local/Cellar/glib/2.40.0_1/lib/libgthread-2.0.0.dylib /usr/local/lib/libgthread-2.0.0.dylib

      sudo ln -s /usr/local/Cellar/glib/2.40.0_1/lib/libglib-2.0.0.dylib /usr/local/lib/libglib-2.0.0.dylib

  2. osxfuse: osxfuse is already installed from the binary distribution and

    conflicts with this formula.

    Error: An unsatisfied requirement failed this build.

  3. Installed this following the steps described here on a clean Mavericks 10.9, and it worked instantly! (Now I finally have brew too 😉
    Thank you very much!
    The only little issue is that transfer speed seems somewhat limited, seems like only 70% of the network bandwidth is used, which does matter on slow connections. Can I change the SSH cipher using sshfs?
    man sshfs gave no answer.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.