Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use TextMate on Mac OS X to develop. The files I need to edit are on a Linux machine, and I have the Linux filesystem mounted on my Mac OS X. Opening the files and saving them in TextMate is not a problem.

What I want to do is to be logged in and working in a command line on the Linux box, but be able to execute a command that remotely commands TextMate on my Mac to open the file, like

user@linux $ mate <filename>

I want that to open up the file in TextMate on my Mac OS X (thus, shifting focus from my to How can I achieve this effect?

share|improve this question
Why do you want to ssh to the linux box? if you can mount the linux box on the mac, and open the files in textmate from the mounted drive, why do you need to go to the command line at all? I don't think it's possible to tell the linux box to tell the mac to run textmate... or, at least not easy... But again, why? – Brian Postow Jun 16 '10 at 22:34
Why do you want to SSH to your Linux machine when the file system is already mounted on OS X? – Daniel Beck Jan 29 '11 at 15:42

I was asking myself a similar question the other day and realized it would just take a little bit of scripting, so I wrote a script to do this. I posted it on GitHub here. This is a bash script you install on the remote system. It uses SSH to connect back to your Mac, mount the Linux filesystem via sshfs, and then open the specified file using OS X's open command. It accepts most of the arguments that open accepts, just passing them through, so it's reasonably flexible. I'm still tweaking it, so let me know if you hit any snags.

I was also pointed to rmate, a TextMate-specific Ruby script that does a very similar thing via scp and TextMate's mate command. This may require TextMate 2, which is available in alpha form on GitHub.

share|improve this answer

I don't believe this is possible. Once you ssh into your remote machine, everything you enter at the command line is passed to the remote machine, which can't launch TextMate on your local machine.

share|improve this answer

You can use sshfs on MacFUSE that allows you to mount (as a "local" drive) any dierctory you can access to via ssh/sftp.

First you need to install MacFUSE (that is a port of FUSE [] for Mac OSX), you can get if from

it is a standard OS X software package that you can insatll by simply double click-ing on it.

Then you need to download sshfs (the piece of software that puts FUSE in relation with ssh)

pick among


according to the version of your OS. Then gunzip it and put it in your path (open a terminal in the place where you downloaded it, then do something like

gunzio sshfs-static*gz
sudo cp sshfs-* /usr/local/bin/sshfs
sudo chmod a+rx /usr/local/bin/sshfs

don't worry if the gunzip step returns an error, it can be that your browser already decompressed it).

Now, open a terminal and do

mkdir local_mount_point
sshfs user@host:folder local_mount_point

and you'll be able to access the contents of "folder" on the "host" in the local folder named "local_mount_point" (of course, you can name it as you please). Hence, a simple

mate local_mount_point/filename

will do.

Of course, you need to install the software only once, and then you can connect (mount) as meny times you want!

BTW, TextWrangler allows to do this without installing extra software (it can save/open files via ssh on remote hosts natively).

share|improve this answer
He already mounted the Linux file system on Mac OS X -- that doesn't seem to be the issue. For some reason, he wants to launch TextMate from Linux. – Daniel Beck Jan 29 '11 at 15:42
I comlpetely missed it... and I can't really see why he wants to do so: he has the file "locally" available, what will be the purpose to connect to the remote host to lunch a command that is available only on the local machine? Mah... – Mapio Jan 30 '11 at 13:20

This won't work directly with an Aqua app.

The app that you're launching would have to be installed on the remote host, and even if the remote host is a Mac you still can't do this with Aqua apps. (The one cool thing about X11 is that it's network aware).

With X apps you can use:

ssh -Y remotehost gedit foo

With non X apps you can use:

ssh -t remotehost vim foo

Gedit and vim are of course examples. Replace with your second and third favorite text editors (since TextMate is apparently your first favorite).

To get the behavior you want in a completely different way, make a script called rmate and put it in your $PATH. The script content is as follows:


TMPFILE=$(mktemp -t textmate-${UID})
scp $1 ${TMPFILE}
mate -w ${TMPFILE}
scp ${TMPFILE} $1
rm -f ${TMPFILE}

To edit remote files in TextMate run this:

rmate remotehost:/path/to/file

You're now editing the "remote" file in TextMate. When you're done save and close the window. The file will be copied back to the remote system in its original location.

Caveate: I don't have TextMate. I tested this with SubEthaEdit, but mate also supports the -w flag (see here) so I assume it will work the same way when closing the window. YMMV.

share|improve this answer

you can connect using ssh user@serverip -Y When you execute a graphical command in the remote machine it will send the graphical interface to the X server of the local machine.


sorry I misunderstand your question, actually you want to use the mac app, not a graphical app in the linux machine... But there are in Windows and Linux several text editors that use plugins to connect via ftp and edit the server files. Googling something like that for mac (I'm not a mac user) I found this link for a ftp/ssh bundle for textmate. I hope it helps you

share|improve this answer
Thanks for revisiting my question! What you suggest is similar to what I currently do (which is to mount the remote directory using Finder/Transmit/MacFusion and to open the files on my Mac via TextMate). However, what I was looking for was a way to open the files in TextMate remotely. For example, on my Mac, I can type into, "mate <filename>" and it opens that file up in TextMate. I know it isn't a big hassle to open the file by myself. I'm just being lazy, but I was just looking for a way to increase my efficiency. :D Thanks again! – yungsters Jun 17 '10 at 7:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .