These instructions use jsvc to daemonize Tomcat. This is the more UNIX method of starting Tomcat at boot time.

Unpack the java server daemon JSVC

The Java Server Daemon JSVC source code is included with the Tomcat 6.0.x binary release.

# Change directories to the Tomcat home directory

# Unpack the jsvc archive
tar -xvzf commons-daemon-native.tar.gz

# Change directories to the unpacked source directory
cd commons-daemon-1.0.5-native-src/unix

Compile JSVC

Execute the following commands to build the jsvc daemon and copy the daemon executable and startup script to the Tomcat bin directory.

The OS X developer tools must be installed.

# Create the configure file

# Create the make file (JAVA 5)

# Create the make file (JAVA 6)
./configure --with-java=/System/Library/Frameworks/JavaVM.framework/

# Build jsvc

# Move jsvc into bin
mv jsvc ../..

# Copy the jsvc startup script into bin
cp samples/ ../..

# Change directories into bin
cd ../..

# Add execute permissions to
chmod 750

Edit the daemon startup script

# Edit
# Make sure the following environment variables are set correctly in
# the startup script for your installation. It is recommended that you run
# Tomcat as a user other than root as to restrict Tomcat's access to the host machine.

# for multi instances adapt those lines.
case "$1" in
# Start Tomcat
# Stop Tomcat
Start Tomcat as a Daemon

# Execute the startup script to start Tomcat as a daemon
# You must execute the daemon as root as it writes the
# daemon's process id to /var/run.
# If Tomcat is already running, first stop it.
sudo ./ start

# Check and see if it is running
ps -ax

# To stop the server ...
sudo ./ stop
Starting Tomcat at Boot Time
If you would like Tomcat to start at boot time, create a Launchd property list to load JSVC. Download tomcat-plist.tar.gz and execute the following commands in terminal.

# Change directories to the LaunchDaemons directory
cd /Library/LaunchDaemons

# Unpack the property list
sudo tar -xvzf ~/Downloads/tomcat-plist.tar.gz

# Make sure the property list is owned by root
sudo chown root org.apache.commons.jsvc.plist

# Test
sudo launchctl load /Library/LaunchDaemons/org.apache.commons.jsvc.plist