Apache Tomcat is an open source web framework (or “servlet container”, in javaverse lingo) for deploying JSP-powered web applications. I needed to get a local copy running on my PowerBook in order to develop a better search engine for Molsoft’s ICM documentation pages– more on that later. At the end of this guide, you should have a complete Tomcat installation running with the manager application enabled.
Warning: There’s a great, but deprecated, tutorial on ADC that this guide borrows heavily from. That said, I do not advise following the ADC tutorial, as the setup of Tomcat has changed a great deal between the version in use at the time of the tutorial’s writing in 2001 (4.0.1) and the current version (6.0.14).
Okay, let’s get going. First, grab a copy of the latest tomcat 6.x tarball .
We’re going to check the md5sum of the downloaded tarball just to make sure we got what we ordered. I neglected to do this on the first go-round, and ended up with a distribution that was missing the manager webapp. Figures.
md5 apache-tomcat-6.0.14.tar.gz
Make sure the md5 hash that this command spits out is the same as the one provided next to your download link. If it’s not, try another mirror.
Extract the tarball in your /usr/local/ directory, or to wherever you want to install Tomcat.
sudo sh
mv apache-tomcat-6.0.14.tar.gz /usr/local/
cd /usr/local
tar zxvf apache-tomcat-6.0.14.tar.gz
rm apache-tomcat-6.0.14.tar.gz
Let’s go ahead and change the ownership of the tomcat directory so that we don’t have to type sudo anymore.
chown -R [user]:staff apache-tomcat-6.0.14
Hey, you have a fully functional Tomcat install on your system now! Let’s write some control scripts to get it running. (This is where we begin to depart from the ADC tutorial… Note that the JRE install location has changed.)
cd
mkdir bin
cd bin
Edit a file called tomcat_start in this directory, and copy the following lines into it:
#!/bin/sh export CATALINA_HOME=/usr/local/apache-tomcat-6.0.14 export JRE_HOME=export CATALINA_HOME=/usr/local/apache-tomcat-6.0.14 export JRE_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home $CATALINA_HOME/bin/startup.sh
Save tomcat_start. Now edit a new file, stop_tomcat, with the following lines:
#!/bin/sh export CATALINA_HOME=/usr/local/apache-tomcat-6.0.14 export JRE_HOME=export CATALINA_HOME=/usr/local/apache-tomcat-6.0.14 export JRE_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home $CATALINA_HOME/bin/shutdown.sh
Save this file, too. Now make both files executable:
chmod +x start_tomcat stop_tomcat
And go ahead and start Tomcat.
./start_tomcat
Open http://localhost:8080/ in your browser and you should see a nice, locally served Tomcat page that should look something like this:

That wasn’t so hard. Let’s roll up our sleeves and fire up the web interface for the manager application to do our first install: http://localhost:8080/manager/html/.

Whoops! 404. Looks like we’ve got some configuring to do. It’s not too bad, though. All we have to do is add a user to the tomcat-users.xml file located under /usr/local/apache-tomcat-6.0.14/conf. Add the following line in between the “tomcat-users” tags with your own username and password:
<user username="admin" password="secret" roles="standard,manager"/>
Save the file and exit. We now need to restart tomcat in order for our configuration change to take effect. Let’s stop and start our server:
~/bin/stop_tomcat
~/bin/start_tomcat
Now Reload http://localhost:8080/manager/html/ and you should get something similar to this:
Now you’re set up with a fully functional Tomcat install. If you’re ready for more, try plumbing the depths of the Tomcat documentation for the 6.x series. It’s a bit aimless, but it’s very informative and worth a careful read. The Application Developer’s Guide is a good place to start.
EDIT: Special thanks to Pete Ludwig for pointing out the necessary restart after the change to tomcat-users.xml.
If you’re really interested in getting a solid understanding of both the particulars of the tomcat framework AND learning the JSP system thoroughly, think about getting yourself a copy of “How Tomcat Works” by Budi Kurniawan and Paul Deck. Don’t let the title turn you off; this book contains thorough treatment of not only Tomcat, but JSP and servlet programming in general.
2 Comments so far
Que piensas

Hi James, first - you have way too many articles that aren’t nicely categori[s|z]ed - this one (above, “Installing Apache Tomcat 6 on OS X”) is an example of the need, ought to have Leopard, Apache, maybe other categories, but as of 14-Apr-2008 is just Uncategorized (ugh!).
Next, so, I’ now looking for the promised article -
“I’ll post instructions on how to set up a source-controlled workflow with cvs, ant, and the optional deployer install as soon as I get it all figured out”
- any chance of a URL, please nicely with cream and a cherry on top,???
Finally, otherwise an enjoyable site-blog-thingy although am not a fan of blogs being used like notebooks, too disorganised especially if the provided features - such as categories - aren’t used well, it tend to become a “write-only, read-never” medium, as even Google etc. have trouble finding a specific article (and who wants to browse page after page of….OK, I’ll stop here
Seriously, nice words, shame about the presentation-medium?
warm regards, Paul.
p.s. Yes, I’ve supplied my website URL, so you can return the accolades favour
Great, simple guide! Helped me lots, thanks. One thing little typo I noticed:
“Edit a file called tomcat_start in this directory, and copy the following lines into it:”
I think you meant to say “start_tomcat” instead of “tomcat_start”, since that’s what you reference later on.