Textmate is a great Mac code editor that can be used to remotely edit files on your Linux based server. You can get all of the features of Textmate while working with remote files which will drastically improve your productivity if you are often working remotely.
I’m using Textmate 2.0 Alpha which is opened source and hosted on Github. To make this work you’ll need to install Ruby on your server as well as a small ruby script.
In this tutorial I will configure an Ubuntu server hosted on Linode but it should work for any Linux based server.
1. Enable remote editing in Textmate
First you’ll need to enable Textmate to accept incoming rmate connections. Simply open Textmate preferences and select “Accept rmate connections.” You can configure a different port but you’ll need to use what ever port you choose in the steps to follow.
2. Install Ruby on your server
You’ll need Ruby and RubyGems installed on your server. I won’t go through those steps in this tutorial but you can easily find articles like this one which show you how to do it.
3. Install rmate
The easiest way to install rmate is to install it via the gem. Login to your Linux server and install rmate via RubyGems.
gem install rmate
You should be able to run rmate now. If the command isn’t found when you execute it verify that your paths are setup correctly.
4. Connect to your remote server
In order for your remote server to allow remote editing you’ll need to setup SSH to forward the port we configured earlier. To connect with port forwarding simply execute:
ssh -R <my-port-number>:localhost:52698 <user>@<server>
Now you should be able to edit any file on your server using Textmate. Simply execute:
and you should see the file open in the locally running Textmate. (Make sure Textmate is open to receive the file.) When you make changes to the file is should save back to your remote server.
This makes it really easy to edit remote files using the awesome feature set in Textmate.