Detached—Terminals that Don't Die when You Close them!

logoDetached is a tool for Macs that makes it easier to manage command-line processes running in the background. Developers spend a lot of time running commands and servers in terminal windows, but closing each window means closing the process running in it. Wouldn't it be great to be able to keep programs running even after their windows are closed? As a matter of fact, every Mac comes with a great tool for managing multiple terminal sessions: GNU Screen. Screen allows you to run terminal processes even after you have closed their windows. Unfortunately, using it can only be described as "byzantine." I created Detached to allow programmers to easily manage terminal session windows.

Detached sits in your Mac menu bar and lets you create terminal windows that you can close and reopen later, without losing the associated session and running process (unless you reboot, anyway). This is how sessions work in most document-based applications: If you close the application with work in progress, you expect it to restore that state when you reopen it. Thanks to Screen, this functionality is built into your Mac. Detached just exposes it by making your terminal sessions accessible from your menu bar.

I originally planed to distribute Detached on the App Store, but I’d need to sandbox the app. Sandboxing the app means not using the core functionality: running AppleScript to power Terminal and iTerm! So instead, I am distributing Detached myself. You can even get the source code for Detached, available under the terms of the GPL.

screenshot

I wrote the first version of Detached about 3 years ago, using MacRuby. At the time, it was difficult to distribute MacRuby binaries because they included the entire MacRuby runtime to be portable. The first distributable binary for the original version of Detached was over 70 megabytes!

It only took a few days to create the initial version of Detached. Once I had it chugging along, it didn’t need much work. Although building Detached was a fun experience, I wasn’t ready to build MacRuby apps for a living or anything. I used Detached, however, almost every day for the next three years! By that time there were umpteen releases of Xcode, and the original Detached project was pretty hard to wrangle. So, I decided to rewrite it in Objective-C.

Rewriting was easy! Cocoa and Xcode have come a long way in the last three years. I had no trouble getting up to speed on ARC memory management and the like. The resulting binary was less than one megabyte, two orders of magnitude smaller than the original, and much easier to distribute!

The only thing missing was an icon for Detached. I am an independent contractor that works with Cloud City Development on projects that require large-scale web expertise. I wasn’t keen on doing the design myself, so I brought it to Stephanie Geerlings and Brendan Miller at Cloud City. We worked through several drafts before we settled on the Detached gopher. Brendan did a fantastic job.

Check out Detached. Let us know how Detached works for you!


Got a question about ruby dependency management?

Or need a second pair of eyes on your Rails app?

Contact us today for a complimentary 30 minute consultation.

get in touch