Apple’s launchd Is Anti-Unix

Starting with Mac OS X 10.4 (Tiger), Apple began to move away from the core BSD Unix-like system that was the genesis of the Apple resurgence on the desktop.

You might think Steve Jobs was the single most important factor in the second rise of Apple. There is no question that he has had a huge impact on the company, and I do not aim to diminish his accomplishments. But going all the way back to NeXTstep, the BSD core has been the backbone of the Jobs operating system vision.

It was BSD goodness that got me to switch from Linux to Mac several years ago. One of the great things about Unix-like systems is that most of your skills, programs, dot files, and highly polished shell scripts are portable. I brought them with me to OS X after dragging them through a dozen or so Linux distributions. There is always a little collateral damage, but it is usually minimal.

Consequently, I was distressed when launchd emerged from the dark side of One Infinite Loop. Launchd is the Apple-created open source program for starting, stopping, and managing daemons, programs, and scripts. It supersedes the init process and a handful of daemons (crond, atd, and inetd/xinetd). Apple’s rationale for this is posted in Getting Started with launchd.

Minor Issues

Merging periodically run jobs into the main system process doesn’t make sense. Replacing a simple /etc/crontab text file with multiple, awkwardly named XML plist files scattered among no less than four different directories is taking two big steps toward complexity.

Starting infrequently used on-demand socket-based daemons from launchd seems like it could open the main system process to a potential denial of service attack. I have not explored this idea or researched to see if it has already been tried, but I would opt for inetd/xinetd over launchd.

Deeper Issues

Reasonable people can argue the technical merits of launchd, and I think a case can be made for improving the original init system. However, I have a deeper philosophical problem with all the functionality that has been rolled into it: One of the core principles of Unix programing is do one thing and do it well. Another is keep things as simple as possible. From that perspective, launchd tries to do too many things, creating needless risk and complexity.

Apple sees launchd as a natural improvement to traditional Unix; I view it as an anti-Unix monolith. It is part of a disturbing trend that I hope does not continue.

Short link:

searchword: launchd

Make a donation to Keith Winston’s Tip Jar.