<< November 2009 | Home | January 2010 >>

No-Fuss Tomcat 5.5 installation on OSX 10.5 (December 2009)

After a bit of googling on the topic I couldn't find a decent guide of how to install Tomcat 5.5 on OSX.  Here's how I did it.

Download the apache-tomcat-5.5.28.zip zip file from 'Core' section of the Tomcat 5.5 download page from here: http://tomcat.apache.org/download-55.cgi
Download the apache-tomcat-5.5.28-admin.zip zip file from the same page

Open a terminal window.

# perform following operations as root
sudo su -

# unpack tomcat
cd /Library
unzip ~/downloads/apache-tomcat-5.5.28.zip
unzip ~/downloads/apache-tomcat-5.5.28-admin.zip
mv apache-tomcat-5.5.28 Tomcat5

# remove the holding page for the message about the admin webapp not being included by default
rm -rf /Library/Tomcat5/webapps/ROOT/admin

# create tomcat group and user
dscl . -create /groups/tomcat
dscl . -create /groups/tomcat Password "*"
dscl . -create /groups/tomcat PrimaryGroupID 498
dscl . -create /groups/tomcat RealName "Apache Tomcat Users"
dscl . -create /users/tomcat
dscl . -create /users/tomcat Password "*"
dscl . -create /users/tomcat UniqueID 498
dscl . -create /users/tomcat PrimaryGroupID 498
dscl . -create /users/tomcat RealName "Apache Tomcat Server"
dscl . -create /users/tomcat NFSHomeDirectory /var/empty
dscl . -create /users/tomcat UserShell /usr/bin/false

# Hide the tomcat user (and all other users with a UniqueID less than 500) from the Mac OS X GUI
defaults write /Library/Preferences/com.apple.loginwindow Hide500Users -bool true

# fix permissions
cd /Library
chown -R tomcat:tomcat Tomcat5
chmod +x Tomcat5/bin/*.sh

# use a text editor to create a launch script
mate /Library/LaunchDaemons/org.apache.tomcat5.plist

paste in the following xml content and save the file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

Configure the tomcat users

mate /Library/Tomcat5/conf/tomcat-users.xml

paste in the following xml content and save the file

<?xml version='1.0' encoding='utf-8'?>
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <role rolename="manager"/>
  <role rolename="admin"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
  <user username="admin" password="secret" roles="admin,manager"/>

Finally, start tomcat

launchctl load -w /Library/LaunchDaemons/org.apache.tomcat.plist

You can now start your browser and point it to:


You can login to both the manager application and the admin application using the username: 'admin' and the password: 'secret'