Mounting a Filesystem via SSH on OSX Mavericks
Table of Contents
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 its 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.
- Download OSXFUSE 2.6.0 at osxfuse.github.io. With the file downloaded, right click on the .dmg file, open and install it.
Install SSHFS #
If you don’t already have Brew installed, go to 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 is open Xcode and accept the agreement and wait for 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 these two lines:
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!