Mount remote folder onto your local disk on the Macbook

. 1 min read

I like working on my Mac but like to keep my development repositories on a headless terminal on the cloud (like a Digital Ocean droplet or a AWS EC2 instance).

Usually, I simply ssh into the server and then edit code using Vim. However, there is something really cool about Sublime Text: The text editor you'll fall in love with! There are apparently plugins to remotely edit files but I want to really feel like working on my local disk.

I was able to get this working after a bit of Google research. Here is what worked for me.

On my Mac (local machine):

  • Install SHFS on the Mac OSX. I downloaded and installed FUSE and SSHFS from the osxfuse site

  • Create the mount point for loading the remote directory and set the permissions of the local directory

sudo mkdir -p /mnt/ssh
sudo chown -R $USER:staff /mnt/ssh/
  • Create the directory structure that you want to mount (I find this consistency useful). I wanted to load my project called happy :-)
mkdir -p /mnt/ssh/var/www/happy
  • Mount the remote directory to the local file system using sshfs
sshfs jason@XXX.XXX.XXX.XXX:/var/www/happy /mnt/ssh/var/www/happy/

I found it important to use the absolute paths from the remote filesystem. Also, it should be possible to use ssh keys but I didn't try that out yet!

  • If everything worked fine, you should able to do see the remote directory accessible locally. Try ls -l /mnt/ssh/var/www/happy/

  • That's it! You should be able to pull the folder into Sublime Text and enjoy working off the server code!

  • When you are done, unmount the directory using ...

umount /mnt/ssh
  • Note, sometimes I had to force a umount using ..
umount -f /mnt/ssh

Tags

AWS Analytics Antifragile Apache Spark Apple Apps Arbitrage Automation Awesome BBMP Bangalore Black Swan Bonds Boonex Bootstrap Brokerage Charges CFPB CMS CSS Calypso Camelot Capital Markets Charts Chirp Choropleth Chrome Code Igniter Collections Containerization Converters Cycling DalalBeat Data Analytics Data Journalism Data Mining Data Munging Data Privacy Data Science Databases Debt Design Design Stock DesignStock Diet Django Docker Document Processing Dropbox Electron Electronics Entertainment Entrepreneurship Exercise FFMPEG Facebook Finance Fire TV Stick Fitness Forerunner From-The-News Fun Futures Gaana Garmin General Geocoding Getting Started Ghost Google APIs GraphicsMagick HHVM HTTPS Hackathon Hacks Hardware Health House Keeping Housing IBM BlueMix IBrokers IPinfo Ideas Image Conversion Image Processing Infographics Interactive Brokers Internet Investing IoT Legal Lets Encrypt Mac Machine Learning Mailbox app Mapbox Markdown Marketing Meteor Mockups MongoDB Mortgages Movies Music MyPad MySQL Nativefier Nature Netflix Newsletters Nginx Node.js Notes OCR OSX Open Source OpenCPU Options PDF PHP Pebble Peloton Personal Photography Picture Platforms Plex Portable Apps Productivity Property Tax PyroCMS Quantitative Finance R-Project Random Raspberry Pi Research Resources Reticulate Robot S3 SQLite STT Scraping Security Server Shell Shiny Side Project Sikuli Speech Recognition Spider Pro Spinning Spotify Startup Resources Startups Strategy Sublime Text System Monitoring Tax Terminal Tips To Do Tools Torrent Trading Trends Troubleshooting USElection2016 Ubuntu Unix Valuations Video Conversion Visualization Wagtail Wearables Weekend Fun WhatsApp Wordpress anaconda annie bash catalina cv2 daily coding dailycoding data.table debugging devtools downloader e-Signatures ggplot git go google maps hat-tip iOS iPad iPhone iTunes javascript jupyter logging macos numpy opencv optionality plotly python rstats videos youtube