Mounting Filesystems in Mac OS X via SSH

    January 8, 2012
    Background

    Over the past month or so, I've been learning to be more and more efficient with the Vim editor. As anyone that's used Vim knows, your vimrc configuration file quickly becomes your best friend. Rather than duplicate and sync the file across all of systems that I work on daily, I've found it easier to mount the remote systems as if they were local volumes and just edit files using my perfectly customized local Vim setup.

    Previously I was using Transmit's "Mount as Disk" feature to access remote machines, but it turns out that it has very aggressive caching that often fails to recognize changes to files made outside of the local machine. This caused me not to see code edits made by a coworker and subsequently let me overwrite them with no notification.

    Instead, I found two very cool pieces of software that allow you to manually control caching - Fuse4X and SSHFS. Check out the steps below to see how I set them up.

    Requirements

    - A Mac, obviously. ;) As of the writing of this post, I'm running 10.7.2.

    - Install Homebrew if you haven't already.

    - Install xCode, as you'll need it to compile SSHFS and Fuse4X.

    - If you've previously used MacFUSE, be sure to completely uninstall it.

    Step 1 - Install git

    You may already have this installed, but in case you don't, type this into the terminal:

    brew install git
    Step 2 - Install Fuse4X and SSHFS
    brew install fuse4x sshfs
    Step 3 - Link Fuse4X as root
    sudo brew link fuse4x

    That's it, you're done!

    Mounting a filesystem

    To mount a filesystem, use this command:

    sshfs user@host:/dir /tmp/ssh -ocache=no -onolocalcaches

    The "-onolocalcaches" option prevents aggressive caching and grabs the freshest copy of a file when it's opened.

    Full details of SSHFS and its command arguments can be found in its manual pages.

    For the sake of automation, I also have a bash script set up to auto-mount my drives. This saves a lot of time for when I have 10 different servers I need to work on.

    Charging Forward!

    January 7, 2012

    2012 is already looking to be an exciting year for both technology and design - two of my greatest passions! I have a lot that I want to accomplish and I'm eager to start the year off right by jumping right in to several projects that I've been putting off. I'll write more about those in the near future.

    As a developer, I hope to accomplish several of Matt Might's (Professor of Computing, University of Utah) 12 Resolutions for Programmers.

    As a designer, I hope to really refine my skills in terms of user interface creation. One of greatest inspirations is a fellow young designer, Andrew Kim. His emphasis is more industrial, but I really admire his sense of style. I am all about minimal, intuitive, easy-to-use creations - whether it's something physical or software.

    Here's to a year full of learning, new challenges and exciting experiences.