O'Reilly logo

Mac OS X in a Nutshell by Chris Stone, Chuck Toporek, Jason McIntosh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring Startup Items

Starting up all the various system service daemons by hand every time the machine starts up would be quite a chore. As part of its coordination of the startup process, the SystemStarter application scans and runs special scripts kept in /Library/Startup Items/. To have a daemon launch at startup and be owned by the root user (so that it is running when the first user logs in, and continue to run until the machine is shut down or it’s explicitly killed), add to this collection of startup items or modify an existing one, if applicable. (More startup scripts are in /System/Library/Startup Items/, but, like everything else in the /System/ folder, are not meant to be messed with.)

Each object under Startup Items is a folder named after its function. Inside it lay two important files: a parameter list of options in StartupParameters.plist (see Section 13.8.3) and the script itself, which must have the same name as the folder.

For example, this is the entirety of /System/Library/StartupItems/SSH/SSH:

#!/bin/sh [1] . /etc/rc.common [2] ## # Start up secure login server ## if [ "${SSHSERVER:=-NO-}" = "-YES-" ]; then [3] ConsoleMessage "Starting Secure Login Server" [4] if [ ! -f /etc/ssh_host_key ]; then [5] echo "Generating ssh host RSA1 key..." ssh-keygen -t rsa1 -f /etc/ssh_host_key -N "" -C "$(hostname)" fi if [ ! -f /etc/ssh_host_rsa_key ]; then [5] echo "Generating ssh host RSA key..." ssh-keygen -t rsa -f /etc/ssh_host_rsa_key -N "" -C "$(hostname)" fi if ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required