Writing remote code on a Mac with SSHFS
Ever wondered how to best develop on a remote box but still finding yourself stuck with Sublime Text/Atom/Visual Studio Code on your Mac?
I’m going to show you how to do it with a tool that I personally use called SSHFS. You won’t need to download text editor plugins again.
As long as you have SSH privileges and credentials, you should be able to use this method.
Go ahead and install
sshfs via Homebrew:
brew install sshfs
It might / might not prompt you to first install a program called
osxfuse. If you run into this, go ahead and run:
brew cask install osxfuse
then attempt to install
Mounting your remote directory
Let’s first create a local directory onto where the remote files/folders will mount to. I picked Desktop for example:
Now comes the fun part! a TLDR of how
sshfs works is this:
sshfs [user@]hostname:[directory] mountpoint
For example, let’s say I have a repository named
hologram-python sitting on my Raspberry Pi (username:
pi , hostname:
zheng-pi) in the
/home/pi/hologram-python directory, this command will be:
sshfs pi@zheng-pi:/home/pi/hologram-python ~/Desktop/mount_folder
Hurray! You’re done! You can now make edits to files/folders that look “local”, and still see the changes in your remote machine!
Once you’re done, you probably want to unmount it. This is the format for doing it on a Mac:
In our example, this will be:
NOTE: If you get an error message that says the drive is busy and that you should use
diskutil, it’s probably because you have a file/folder opened somewhere, and it cannot be unmounted. Close the appropriate files/folders and try again.
For more info, you can visit the
sshfs page here: