These steps will guide you through installing
daemontools
0.76 on MacOS X 10.1.1. Steps
that differ significantly from Dan Bernstein's installation
instructions are in red if your
browser supports CSS. Please send comments and corrections
to mayoff-daemontools-macosx@dqd.com.
-
Install the BSD Subsystem package from the MacOS X install CD, if you have not already done so.
-
Open a Terminal window. The Terminal application is in the Utilities folder, which is in the Applications folder.
-
Become root:
sudo -s
You will probably need to type in your password (not root's password) after running the
sudo
command. -
Create the
/service
directory:mkdir -p /service
We do this now to prevent the
daemontools
installer from doing a step that does not work on MacOS X. - Create the
/package
directory and change to it:mkdir -p /package chmod 1755 /package cd /package
- Download
daemontools-0.76.tar.gz
:curl -O http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
- Unpack the
daemontools
package:tar xpzf daemontools-0.76.tar.gz rm daemontools-0.76.tar.gz
-
Set the compiler and linker commands:
cd admin/daemontools-0.76/src perl -pi -e 's/^gcc/cc/' conf-* perl -pi -e 's/-s/-Wl,-x/' conf-ld
After this step,
conf-cc
should contain this:cc -O2 -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings This will be used to compile .c files.
and conf-ld should contain this:
cc -Wl,-x This will be used to link .o files into an executable.
- Compile and install
daemontools
:cd .. package/install
Normally this step would create
/service
and append two lines to/etc/rc.local
. However, MacOS X does not use/etc/rc.local
. Since we already created/service
,package/install
will not try to create it or modify/etc/rc.local
. - Create
a new subdirectory named
/System/Library/StartupItems/ServiceScanner
, and change to that directory:cd /System/Library/StartupItems mkdir ServiceScanner cd ServiceScanner
- Create a shell script named
ServiceScanner
to startsvscan
:cat > ServiceScanner <<end #!/bin/sh echo "Starting svscan" /command/svscanboot & end chmod +x ServiceScanner
Be very careful to include the
&
at the end of thesvscanboot
line. If you leave that out, your system will hang while booting and you'll have to boot in single-user mode (by holding down Command-S during during the boot sequence) to fix it. - Create a property list file
named
StartupParameters.plist
describing the new startup item:cat > StartupParameters.plist <<end { Description = "daemontools svscan"; Provides = ("svscan"); OrderPreference = "None"; Messages = { start = "Starting svscan"; }; } end
- Reboot.
You can check that svscan
is running using the
ps
command. For example:
[ice:~] root# ps axwww | egrep 'svscan|readproctitle' 245 ?? S 0:00.02 sh /command/svscanboot 250 ?? S 0:00.15 svscan /service 251 ?? S 0:00.02 readproctitle service errors: ................................................ 389 std R+ 0:00.00 egrep svscan|readproctitle