2

What's an easy way to be able to edit remote files such as bash scripts? Currently I'm using Vim on the server, but that's obviously not ideal, particularly when lag is noticeable.

On Windows, I'd probably use WinSCP. I'm newish to Mac so could be missing something obvious.

I have SSH and SFTP access to the machine, but no root on it. Using Finder's "connect to remote server" (sftp://my.server.com) didn't work - just spins and doesn't connect. But sftp from command line is fine.

1

5 Answers 5

2

You could use MacFuse and the SSH FS to mount the remote path into a local mount point and edit it with the local editor of your choice.

2
  • Incredibly, this worked. I say "incredibly" because MacFuse is no longer supported, and the SSHFS binaries stop at Leopard (I'm running Snow Leopard). But I just installed MacFUse then ran the SSHFS leopard binary, and 5 minutes later the remote drive is mounted locally! Wow. Thanks! :) Jan 16, 2012 at 5:21
  • FYI trying this with OS X 10.8.2 running my text editor (Sublime Text 2) and a remote Ubuntu 12.04 server holding the code in a git repository, there seems to be all manner of havoc happening with files that are not changed showing as changed, empty files showing up, etc. Too flaky sadly to rely upon. Going to try Sublime SFTP next. Nov 2, 2012 at 18:01
2

MACOSX finder does not support sftp yet.

If you enjoy command line option,you can use local vim or vi to edit remote file easily with

vim scp://[email protected]//path/to/document

If you are fan of gui based editor, you can try TextWrangler. It can load and save file over sftp.

1
  • Yeah, syntax highlighting and copy-paste are big advantages over vim. Jan 16, 2012 at 5:23
1

I would recommend using Cyberduck for SFTP and Sublime Text 2 Editor. I use this combo on my Mac daily. Bonus is both programs work on Windows too.

0

Ok, this script seems to fill my needs:

SERVER=my.hardcoded.server.name
EDITOR="/Applications/TextMate 2.app"
if [ -e /tmp/$1 ]; then
  echo "/tmp/$1 already exists - exiting."
  exit;
fi
scp $SERVER:$1 /tmp/$1 || exit
open -W -a "$EDITOR" /tmp/$1
scp /tmp/$1 $SERVER:$1 && rm /tmp/$1
0

I can't add another link to my previous answer.

Update: more discussions on SFTP / remote editing at http://news.ycombinator.com/item?id=3455360 using Sublime Text. Might be of value to you also.

1

You must log in to answer this question.

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