Installing Tomcat 6 on Snow Leopard

Snow Leopard comes with Java 6, so Tomcat installation wasn’t much of a problem.

The procedure involved just downloading the Tomcat 6 binaries from the Tomcat download site, I downloaded the tar.gz portion of the Core packages. The next step steps were to copy the Tomcat package to the home folder (you can put it anywhere you want though, but I like putting the Tomcat installer in home folders for dev purposes), extracting the tar.gz package, then running Tomcat.

Once you have downloaded Tomcat 6, you can follow these directions.

$ cd ~
$ mkdir progtools
$ cd progtools
$ cp ~/Downloads/apache-tomcat-6.0.20.tar .
$ tar -xzvf apache-tomcat-6.0.20
$ mv apache-tomcat-6.0.20 tomcat6

I just created the progtools directory because this is where I install my programming tools, you can store yours anywhere you like. I also renamed (mv) apache-tomcat-6.0.20 to tomcat6 because I know I will be working with tomcat6 exclusively on the command line, so tomcat6 is a lot easier and faster to type than apache-tomcat-6.0.20

Testing out Tomcat

The startup.sh and shutdown.sh scripts–which are located in tomcat6/bin are the 2 scripts responsible for starting up and shutting down Tomcat. At the time of download, they already have eXecute privileges, so I didn’t have to do anything extra ordinary. You can start tomcat by

$ cd ~/progtools
$ tomcat6/bin/startup.sh

Tomcat will run in the background, but will let you see some of its trace, like this.

$ tomcat6/bin/startup.sh
Using CATALINA_BASE: /Users/ted/progtools/tomcat6
Using CATALINA_HOME: /Users/ted/progtools/tomcat6
Using CATALINA_TMPDIR: /Users/ted/progtools/tomcat6/temp
Using JRE_HOME: /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home

Notice that the JRE_HOME is already set. You launch the Safari browser or any browser of your choice, then point it to http://localhost:8080, you should now see the welcome page of Tomcat.

To shutdown Tomcat, you can execute

$ tomcat6/bin/shutdown.sh

It should give you the same trace as when starting up.

Configuring Tomcat to run on port 80

Tomcat actually contains a webserver, by default this webserver runs on port 8080, if you need to change it to any other port, you need to go inside the configuration of Tomcat. The file server.xml which is located at inside tomcat6/conf/server.xml contains all the configuration settings for Tomcat. You can edit this file and change the value of the port for the non-ssl http 1.1 connector–this connector is responsible for listening for web request.

You can edit the value of ‘port’ in the line where it says the protocol is http/1.1, by default, it’s value is 8080. You can change it to port 80 if that is what you’d like to do–I would advise not to do it because it will conflict with Apache if you have Apache running on Snow Leopard.

If you changed anything inside server.xml, you need to save and restart tomcat for the changes to take effect.

$ tomcat6/bin/shutdown.sh
$ tomcat6/bin/startup.sh

There is a tomcat resource page on the Apple site, it’s a bit dated because the version of Tomcat is ver 4, but most of the instructions are still good.

If you want to show appreciation for my efforts dear reader, you could buy me a tall hazel nut Americano ($2) via PayPal. Thanks
Post navigation
(previous post)
(next post)
| | | | .

{3 Comments below .. you can add one }


Dannel 1.26.2010at 09:56

hey man, thanks for posting this!


Chris Allport 3.1.2010at 01:33

Thanks for this article. These instructions were very simple to follow and got me up and running in a few minutes.


matteo 3.3.2010at 18:01

Quick and effective, thank you!

Leave a comment