First a little introduction, what is rmate?
I read the blog post about TextMate 2 adding remote editing.
rmate myfile on the server, it connects to TextMate 2 via a SSH tunnel making editing a breeze.
Setup SSH to automatically create the tunnel
In a previous article SSH Tips I wrote about how a couple of lines in a config file can make your life a whole lot easier.
The new addition to the
~/.ssh/config file is:
RemoteForward 52698 localhost:52698
As soon as you connect to a server via SSH it will start the remote tunnel.
I wanted it to be simple to install the rmate command to the remote server, so I created ssh-copy-rmate.
What it does is downloads the latest rmate script from github and via SSH copies it to the file
/usr/local/bin/rmate on the server and sets the right permissions.
Since I´m using Sublime Text 2 I also created a clone of the install script called ssh-copy-rsub which names the file on the server to rsub instead of rmate.
and place them in your path or in
The default is to use the ruby version of the script which requires that you have ruby installed on the server.
If you specify
ssh-copy-rsub -b email@example.com) it will fetch another version of rmate which doesn't require ruby.