Question or issue on macOS:
I LOVE using TextMate on my MacBook. It’s great.
Unfortunately, I want to edit some files directly on my dev server, since it’s difficult to recreate the environment locally. I’m using Git, so one alternative is to just edit locally, git commit, git push, and then git merge, but that’s kind of complicated every time I want to make a simple change.
I’d rather just … use another solution. One thing I tried is mounting a hard drive via MacFusion, and then loading that in an editor. But that’s so freaking laggy/slow!
Has anyone cooked up a better solution?
How to solve this problem?
Solution no. 1:
OK – here is the one that works on Mountain Lion.
- Go to http://osxfuse.github.com/
- Install FUSE for OS X
- Install SSHFS for OS X
- Then the following commands on your terminal:
mkdir /Volumes/SSHFS
/usr/local/bin/sshfs [email protected]:/path/to/dir /Volumes/SSHFS
Done.
I would also recommend using the ReMate plugin as pointed out by another user to prevent TextMate from beach-balling every time you refocus it. Link:
ReMate http://ciaranwal.sh/remate
Solution no. 2:
I use Fetch and TextMate for just such tasks. Fetch can be set to use TextMate as an external editor and can even automatically open files in TextMate by double clicking.
Saving the window in TextMate automatically pushes the file back to the server. Of course you would have to commit the changes on the server at a later time.
I’m sure most Mac FTP clients could do the same.
Solution no. 3:
The best thing would be using TextMate’s rmate script, follow the link and you’ll find the instructions bellow, I recommend it since it will make your life easier and handle all the Nitty-Gritty.
Solution no. 4:
I use the free version of TextWrangler for just this and it works great. I can load and save files over sftp.
Solution no. 5:
The correct answer is to use sshfs and make sure “Perform atomic saves” is checked in the Textmate preferences window. The easiest way to setup sshfs is to use Macfusion. http://macfusionapp.org/.
Solution no. 6:
Try one of these methods.
see: http://wiki.macromates.com/Main/FAQ#projects
also have a look at:
http://www.gnu.org/software/tramp/
Solution no. 7:
You don’t need to push
every time you make simple changes; git is a distributed version control system, you commit
to your local repository for the small changes. You should only push
to the remote repository once you finished working on a feature/bug (or for really huge feature, a complete subfeature). Well, that’s assuming you can recreate the environment; which apparently you can’t.
A decent text editor can have integration with your favorite control version system; if you cannot configure your editor to commit and push from inside your editor, get a decent editor.
An even better editor can be set to save, commit, push, compile, and run your program all in one click or keypress.
Solution no. 8:
If you are not able — for whatever reason — to replicate your environment locally and still want to use TextMate, the FTP client+TextMate combo is the best solution I can think of. MacFusion and all the other similar solutions are neat on the paper but awfully slow.
If you feel adventurous and confident enough to drop the TextMate requirement, SSH+Vim in the terminal works amazingly well.
Are you positive you can’t replicate at all your remote environment?
Solution no. 9:
I know this question already has several answers, and it’s been a while, but I wanted to also point out DokanSSHFS – This will use SSH to make a local drive of the directory location on the server that you choose. Then you can use your editor of choice to edit the files as if they were on a local disk.
Solution no. 10:
Most of the proposed solutions are centered around sshfs in one form or another. I have tried these solutions, but I found that reliability of filesystem is not always as good as desired.
There is tool called rmate, which allows editing of remote files in text mate.
Use command from ssh session to edit file on the server:
rmate file_name
The readme on github provides easy to follow instructions on how to set it up.