Remote TextMate Projects
You want to know the easy way to use TextMate’s Projects with files located on a remote server? Read on…
The Problem
TextMate is by far my favorite text editor for OS X, but the fact that its Projects view (and all its associated features) doesn’t work with files located on a remote server can be pretty frustrating when you’re working on a website. It goes something like this: you fire up Transmit (or similar FTP program), highlight the files you need to work on, and hit the ⌘+↓ key combo to open them. Now you got 30 windows littering your screen, you open a blank Project and start adding each file to its empty Project drawer while thinking that maybe you should just use BBEdit on that one…
Some Alternatives
There are a few different ways to deal with this problem. The first one is to develop locally and then upload to the live server. That’s the easiest solution, and what I do whenever I can. But sometimes, it’s just not practical. A semi-automated way to achieve similar results is to use Interarchy and its “NetDisk” feature. Not a bad solution but you have to buy Interarchy and it’s still a local → server synchronization process, not real live editing on the server.
At the other end of the spectrum, there’s Subversion. It’s the most elegant way to deal with the problem, but it’s not available on all servers and it’s a slightly overblown solution if you just need to perform random updates on a site you’re the only one working on.
The Solution
Update: the solution just got even better thanks to Jan’s tip.
A simpler yet powerful solution, which -requires only minimal use of the Terminal and- takes about 2 minutes to setup, is to get the remote server to mount directly in the Finder and trick TextMate into thinking it’s a local directory.
The only requirement to get this working is to have SSH access to the server.
How To
- Download and install MacFUSE (will require a restart)
- Download and install MacFusion (the 1.0 release has a bug in its Keychain password implementation, download the 1.01 Beta Release instead unless a newer version is out by the time you read this)
Setup a SSH Key pair for automatic authentication- Enjoy… You’re done!
MacFUSE is needed to use MacFusion. MacFusion is a menubar item that lets you mount remote volumes in the Finder. It works with SSH or FTP, allows you to create Favorites, and saves your passwords in your Keychain. Life is beautiful…

Easy access to your servers from the menubar
Just enter your server info like you would in any FTP application, click on “OK” and your server will show up in the Finder like a regular local network volume. That’s it! Now you can open multiple files as Projects (and save them) on any server via SSH or FTP. TextMate will treat them just like any other local Projects. And thus, the only TextMate annoyance I ever came across vanishes…

Your server… in the Finder!
One last note: TextMate leaves invisible files all over the place (more info at the bottom of the Saving Files section of the TextMate manual) which might make some people unhappy if you’re working on their server. So it might be a good idea to turn off this feature by running this command in the Terminal:
defaults write com.macromates.textmate OakDocumentDisableFSMetaData 1
Optional: Set Up SSH Authentication
MacFusion supports SSH authentication which is more secure than password authentication, and I like the fact that you just copy your public key to all your servers, no need to set any passwords in MacFusion. It’s slightly geeky, but actually really easy and completely optional. Here’s what you do:
Open up the Terminal and type: ssh-keygen -d
Hit enter 3 times to get to a prompt that will read something like:
The key fingerprint is: 33:3c:5d:41:97:1b:fc:f5:9f:69:54:2e:0b:f1:24:7f
Once that’s done, you’ll have an invisible folder in your User account. To view it, use the Finder’s Go → Go to Folder menu item (“⇧+⌘+G” shortcut). Type in: ~/.ssh/ and you should see something similar to that:

Your public key will be in this invisible .ssh folder
Almost done! Now you have to copy the content of your public key file id_dsa.pub into a file called authorized_keys2 on the server. This authorized_keys2 file needs to be in a folder called .ssh (with the dot) at the root of your account. You can do that with a fancy Terminal command line like:
scp ~/.ssh/id_dsa.pub www.your_site.com:.ssh/authorized_keys2
Or, if like me you enjoy the feel of your mighty mouse clicks, just create the file via FTP and copy paste the content. If you use TextMate to do so, you won’t have any problems. And if the .ssh folder doesn’t exist, you can create it yourself. Just make sure the “show invisible files” option is turned on in your FTP program. You can copy your public key file to as many servers as you like to get access to each one of them.

You can create your own .ssh folder if needed
Now that you got your private key setup on your Mac and your public key copied on your server, just setup MacFusion to use your SSH public key.

Select the Public Key authentication method
More Info: This rsync article has clear and detailed info on ssh public key authentication if you want to know more.
Comments on this article
Nice writeup! Things can be made even easier with MacFusion: http://www.sccs.swarthmore.edu/users/08/mgorbach/MacFusionWeb/ http://code.google.com/p/macfusion/
Jan, on 2007.05.05
Great post, I’m amazed at how easy this was to setup.
Thanks for taking the time to write this up and share it.
davermont, on 2007.05.06
Thanks for this excellent tutorial, this was one of the features I always wanted in Textmate/OS X.
Greetings
Patrick, on 2007.05.10
Just be careful with sshfs and edits done directly on the remote server, sshfs’ caching can mask those and you can overwrite changes on the server.
Chris, on 2007.06.07
Thank you, thank you, thank you, thank you! Did I say thank you yet?
We just moved a Rails app I have been working on from my local machine to our development server and the SOLE reason I was fighting this was because I did not want to resort to using BBEdit again – which was almost better than Transmit, TextMate, back and forth. Of course BBEdit still required me to look for files, but I was removing the FTP step in the process.
You just made my day with this post – did I say THANK YOU yet?
Scott Parks, on 2007.07.31
Just a few notes to help people optimize this process. If you are on domestic cable or dsl or an otherwise slower connection to your remote filesystem and want to use macfusion + textmate you might want to:
1) When you need to save a project file for regular use, save the project file itself locally, not on the remote server. Otherwise it seems to take a lot more network overhead when expanding folders and such which can translate into multiple seconds of waiting when opening or switching documents. The project file should stay valid as long as your paths don’t change.
2) Set the Finder to show invisible files. In the Terminal type:
This way you can work easily with .htaccess .htpasswd files that would otherwise stay hidden on the remotely mounted volume.
This setting is system wide, to turn it off, change the value TRUE to FALSE
John, on 2007.10.20
Isn’t this EXTREMELY slow for anyone else? I get the beachball after just about everything I do inside of TextMate (including just switching from one open file to another). I’m on a fast machine with a fast internet connection connecting to a fast server.
heeb, on 2007.11.01
If you’re working on something big, you might want to only load part of it into your TM project. To give you a reference, I have no problem working on a default Drupal install for instance.
Opening an empty project and dragging the drupal directory in the TM project drawer will initially take a while to load, but after that, I can switch between files with minimum time lag, it’s not as fast as with local files of course, but it’s fast enough to stay out of the way while I’m working.
Yann, on 2007.11.04
This might come in handy.. Thank you..
Henrik Kjelsberg, on 2007.11.07
Hey, great writeup, thanks very much, just what I needed.
Chris, on 2007.11.07
I wish I could just do “mate filename” in my ssh session. THAT would be awesome ;-)
Carl, on 2007.11.27
Bonjour Yann, Have you moved to Leopard ? Any update on your TM Remote Project, and are McFuse-Macfusion all working fine ?
thks for any info
All the best from Antibes, Fr.
Laurent SJ, on 2008.02.13
I haven’t updated to 10.5 on my dev machine yet… From previous experience, I’m pretty skeptical about the whole archive + install thing. I’m shooting for a clean instal… but for that I need to find a couple of days open in my schedule without any work… sort of impossible right now ;)
Yann, on 2008.02.15
I am trying to get SSHFS working with Textmate right now, but I’m always failing when dragging and dropping the folder to my project drawer. Whenever I try this Textmate hangs totally giving me the wheel of doom. The roots folder name appears, but thats all.
Do you have any information on this? I could not find any info in the forums and so on, but as it seems that its running for you, I think there must be a way…
The SSHFS itself seems to run fine though, I can edit, browse and all this, its just a mess when dragging a whole folder into the project drawer.
Arne, on 2008.02.21
I got quite excited about it, but I find it very slow too on the smallest of edits :(
Chris, on 2008.02.28
Way too slow, sorry. I cannot work when my machine slows me down.
Luke, on 2008.03.24
Yeah, It seems some people are experiencing slow response times.
I don’t have this problem… It takes maybe 5 seconds to initially load a project and switching between files has maybe a .5 second delay. Saving is just as fast as through regular FTP.
It would be interesting to find out what’s causing this…
Yann, on 2008.03.24
When I switch between files in the Textmate-Project the speed is ok.
BUT: When I go to Safari (reloading the page to test my programming), then switch back to Textmate, it’s quite slow (2sec).
:(
BerlinChris, on 2008.05.21
For that particular problem, you might want to check this plugin:
http://ciaranwal.sh/remate/
Yann, on 2008.05.22
I’ve not tried this yet, so I can’t say how slow it is, but I’d just like to chime in to say that there is no reason it needs to be! I switched to TextWrangler about a week after I paid for TextMate, largely because of its ability to open files directly from FTP and SFTP, without screwing around with Transmit, etc. Saving is very fast- I almost never have to see any notification of waiting (progress bar, window, pinwheel, etc), even on 400 KB files. By the time I cmd-tab back to iTerm, the recent save is at the server and done.
I don’t see why the TextMate developers don’t just do the same thing. I mean, obviously people want this feature badly- why don’t they implement it?
Aaron Reichow, on 2008.05.22
I just gave this a whack- and I’m pretty disappointed. Hopefully the TextMate folks will wise up and add real FTP and SFTP support, ala TextWrangler, ASAP! It was dreadfully slow compared to what I’m used to with TextWrangler.
I did a bunch of tests with saving modifications to randomly generated 1KB files (just in case SSHFS caches) via SSHFS from within TextMate, TextEdit and TextWrangler- all three took an average of 2.5s, regardless of whether or not I saved a few lines of changes or the whole file.
TextWrangler, via its built-in SFTP capability, performs the same tasks in under a half second, which was the smallest time I could record in the way I was doing things. Often, saves were subjectively instant. On 300KB files containing actual Java code, TextWrangler will take the same 2.5s to upload a file.
The slowness of TextMate+SSHFS goes beyond just the lag TM has when switching between files in a Project in the GUI- fixing that is a must (and sounds like it’s been solved), but the core problem of SSHFS is still very much there.
Alas- hopefully they’ll add real SFTP/FTP editing capability soon!
Regards, Aaron
RevAaron, on 2008.05.29