OSX Terminal Notifications

I recently found myself task-switching quite a bit, and losing track of longer running programs in the process. I went looking for a low effort way to get Terminal to display a notification when a program exited while terminal (or the running shell session) was in the background. I quickly found a solution in two parts:


terminal-notifier is a Mac App that provides a simple CLI to create notifications in notification center. Pipe text in, get a notification out. Easy.

Now for the shell integration:


zsh-notify is a plugin for zsh that supports terminal-notifier, as well as growl (for ye olden MacOS versions ;)).


There’s really only one option to configure, and that’s the notification timeout. You set this as an environment variable:


This will create a notification for any task that takes longer than 5 seconds. The default is 30, which is way too long for my twitchy, app-switching fingers.

Cool, but I don’t use zsh…

Well, you should give it a try!

I don’t use bash any longer, but with terminal-notifier it’s super easy to fire them off ad hoc:

./run-a-long-program && terminal-notifier -message "Finished run-a-long-program"

And voila!

terminal-notifier screenshot

But seriously, you should try zsh.


VirtualBox Hates Sendfile

I’ve begun using Vagrant with Virtualbox for Web Development, specifically for Rails development. This allows me to spin up an environment as close to production as possible, and it keeps my host system clean from various projects’ clutter. It’s quite lovely, and I’ll definitely devote a separate post to that topic. However:

Recently, I ran into an issue with Sendfile and Virtualbox’s shared folder support. It seems that the use of Kernel sendfile by either Apache (both debian and centos flavors) or Nginx to serve static files doesn’t work if you update those files at all once they’ve been served. Needless to say, this doesn’t work for doing any Javascript development…

After digging, the fix is simply to disable sendfile support in your HTTP server of choice. A quick search for ‘sendfile’ in your httpd.conf, apache.conf or nginx.conf will reveal an ‘On/Off’ toggle:

# EnableSendfile: Control whether the sendfile kernel support is
# used to deliver files (assuming that the OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile
EnableSendfile off

The solution to the issue can be found in the VirtualBox forums: http://forums.virtualbox.org/viewtopic.php?f=1&t=24905

More info about Sendfile can be found in the Apache documentation: http://httpd.apache.org/docs/2.0/mod/core.html#enablesendfile

Sublime Text 2 Updated

Sublime Text 2 has been updated to include a Command Line Utility, subl!

Here’s a few gotchas:

  1. Be sure to specify the ‘-w’ or ‘–wait’ option in your git config.
  2. Currently, Sublime tries to keep folders opened from the command line in the same window. This is different behavior than TextMate, and I find it a bit obnoxious for searching and open quickly. To emulate ‘mate .’ behavior, use the ‘-n’ option to open the folder in a new Sublime editor window.

Sublime Text 2

TextMate users, meet Sublime Text. Its TextMate’s younger, flashier, cousin.

Don’t get me wrong, I love TextMate. It’s been the best native text editor on the Mac for quite some time. However, the message is clear:

Sublime to TextMate, “Anything you can do, I can [or likely will soon be able to] do better.”


  • Open Quickly kicks the pants off of TextMate’s ‘Go to File’. It’s faster, preloads documents, and allows you to jump right to functions and lines within files.
  • Split Panes! While I haven’t actually used this feature yet, I can recollect situations where it may prove useful. For example, jumping between models and schema.rb in rails apps…
  • Uses tmBundles for syntax highlighting and tmThemes for color schemes. Just copy and go.
  • You can configure just about anything, including hiding the obnoxious mini-map.


  • No CLI binary. This means I’m still in TextMate for my git commits… :/
  • Doesn’t do as well as TextMate with file reloads from outside Sublime. I’ve run into a couple instances where I’d switched git branches and Sublime didn’t update the open files.
  • The mini-map is weird. This is Sublime Text 2, not Starcraft II. Let’s be real guys, on my 15″ MacBook, I’ve got code over there.

Granted, it’s in alpha, so it’s bound to be a little flaky. However, it’s under active development and getting better all the time. I’ve been using it steady for a few days now and I find myself spending more time in Sublime than TextMate.