May 29, 2009

Setting up Tomcat 5.5 on Mac OS X 10.5

khallmark @ 8:38 am —

Installing Tomcat 5.5 on Mac OS X 10.5 is a fairly easy process. I have adapted and distilled these directions from the Apache Foundation Tomcat Wiki. I also have modified the provided Startup Item provided on the wiki and I have made it available for download from this site.

Installing Tomcat

  1. Download Tomcat 5.5 from the Apache site. You’ll want to download the latest version of the “core” package (this is all you need to get Tomcat started)
  2. Put the contents of the package in your favorite install location. From now on we’ll call it DIRECTORY. I choose to put mine in “/opt/local/tomcat” because this is the location of my MacPorts files. You could easily put it anywhere. Remember DIRECTORY, you’ll need it later.
  3. Fix the permissions. The recommendation by wiki is to set wide open permissions, to make all the files 777. Realistically, I feel like there should be a more restricted permission set that should work.
  4. Open (/Applications/Utilities/
  5. Navigate to DIRECTORY
  6. Type “./bin/” into the Terminal and hit enter
  7. Test the server by going to You should see a the default Tomcat page, which looks like the image below.


Tomcat is working properly

Tomcat is working properly

Installing the StartupItem

Once you get Tomcat installed, you’ll probably want to install the StartupItem as well. This will allow Tomcat to start on boot.

Download the archive

  1. Add this line to /etc/hostconfig as root:
  2. Open the downloaded archive, it should unzip to a folder called Tomcat
  3. Open up the file named “Tomcat”
    1. Update line 12 of the script to point to your DIRECTORY
      export DIRECTORY=”/opt/local/tomcat”
    2. Update line 15 to point to the version of the JDK you want to use
      export JRE_HOME=”/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home”
  4. Copy the Tomcat folder to /Library/StartupItems/Tomcat
  5. Open and type the following commands
    1. cd /Library/StartupItems
    2. sudo chown -R root:wheel Tomcat
    3. sudo chmod -R 755 Tomcat
  6. Use the script to start/restart the server by typing 
    /Library/StartupItems/Tomcat/Tomcat [start|stop|restart]  
  7. The server will now start on boot
  8. TIP: You might want to add an alias to this script in your .profile
    alias tomcat=”sudo /Library/StartupItems/Tomcat/Tomcat”