Web coding on a mac

If you’re developing for the web, the chances are good that you have a server out there somewhere running a LAMP stack. If you’re doing a lot of iteration – which is probably a good idea – you’ll want to find a quick way of changing code on your server rather than downloading & uploading all the time.

Option one: Use vi

The cleanest way to develop code on that box is to SSH directly in there, and use vi, but it’s not all roses.

Advantages:

  • Great syntax highlighting
  • vi is frighteningly fast if you know how to use it
  • You can use the same environment from any laptop running os x or linux, and it’s instantly familiar
  • You don’t even need to install any software locally

Mannequin coverDisadvantages:

  • vi’s learning curve

For newbies like me, watching someone who’s familiar with vi makes me feel like Emmy from Mannequin. (“Where did they hide all the musicians?”)

So, you could spend a long time learning vi, or try something else.

Option two: Use something else

If you’ve ever used Dropbox, you’ll know that having a remote filesystem mounted in Finder makes working with files super easy. Luckily, there’s some great OSS around to help you do just that. Here’s how to get started:

  1. Download and install MacFuse from here
  2. Download and install MacFusion from here

After restarting your mac, you’ll be able to mount both SSH and FTP servers right into your filesystem. Now, you can use your text editor of choice on the mac, directly working on the files you want to play with.

Advantages:

  • Use any text editor you want (I use TextWrangler because I’m cheap)
  • Use all your mac’s keyboard shortcuts

Disadvantages:

  • You need to install some software locally, so you’re screwed if you have to move between laptops

Being a vi numpty, I chose this second path, and so far it’s working a treat. However, there is a bug in the current version of MacFusion (v2 final).

Macfusion Bug on sshnodelay.so

When connecting over SSH, you’ll note that the connection can’t be made. You’ll see a “remote host disconnected” error, and on examining the log in MacFusion, you’ll see this:

dyld: could not load inserted library: /Applications/Macfusion.app/Contents/PlugIns/sshfs.mfplugin/Contents/Resources/sshnodelay.so

The solution is to rename the file to something else. Head into Terminal, and type this:

cd /Applications/Macfusion.app/Contents/PlugIns/sshfs.mfplugin/Contents/Resources/
mv sshnodelay.so MOVED_sshnodelay.so

… and voila, you can now mount over SSH no problem! (source)


Comments

4 responses to “Web coding on a mac”

  1. Editing unversioned files directly on the server? You’re insane/experimenting, right?

    How about putting your web code into subversion, and having a hudson job pick up those changes and deploy them to your test server?

    And I know that nit-picking makes me look like an idiot, but “a lot of iteration”? Is this how I’m going to have to speak once I move to California?

  2. In my case I use a dev box that I edit directly to test stuff, and that gets pushed into the trunk via SVN when it’s beaten into shape. Our prod servers are all failover clustered cdn cached thingies that I stay away from 🙂

  3. Shelly

    Hi,

    Nice blog you have. Why have you stopped blogging?

  4. Myself, I prefer Cyberduck. Connect over any supported protocol (there are many of them, sftp of course included) and right click a file and select edit. The files is cached locally, but as soon as you save, the file gets uploaded. Works well, and I imagine it’s less error-prone than actual ssh file system mounting.

Leave a Reply

Your email address will not be published. Required fields are marked *