Remote File Editing on the Raspberry Pi using sublime Text 3 and iterm

If you are developing software for the Raspberry Pi, you will want to edit source files on a faster machine than on the Pi. I connect to my headless Raspberry Pi from my Mac and edit python files remotely using Sublime Text 3 and iTerm

What you need

1. On the Pi: Install rsub

sudo wget -O /usr/local/bin/rsub https://raw.github.com/aurora/rmate/master/rmate

chmod a+x /usr/local/bin/rsub

2. On your Mac: Sublime Text 3 install rsub package

Open Package manager, use the "Install Package" command to install "rsub"

3. On your Mac: iterm: setup a ssh session to your Raspberry Pi

In the ssh command, add  -R 52698:localhost:52698

See the image below. This session will log into your Raspberry Pi at the specific IP address, sign in using the default "pi" username, and also enabled reverse port forwarding, forwarding connection on the Pi to port 52989 back to your Mac so that sublime Text can edit the files.

4. Use rsub to edit files

On the Pi, just type rsub filename and Sublime Text 3 on your mac will magically open up that file remotely.

Reference

This article describes the process in greater detail.