Mac OS X: Apache Tomcat: Install
Get the Tomcat software
Download the binary from:
Move this file to wherever you want it to be installed. I placed it into /Applications. (Throughout these directions I provide file paths for this directory. If you chose a different install location you’ll have to modify these paths as necessary.)
Then drag-and-drop it onto Applications / Utilities / Stuffit Expander (Carbon) to expand the file.
Prepare your environment
Open Applications / Terminal. At the shell prompt type pico ~/.login and enter the following lines of text:
setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework
setenv TOMCAT_HOME /Applications/tomcat-4.0-b1
Now hold down the control key, and hit the x key. Type ‘y’ to indicate you want to save the changes, and then hit enter. You should be out of pico now and back at the command line. Type source ~/.login for the changes to take effect.
Enable the root user (the superuser)
Determine whether you’ve enabled root on your box. Open the Terminal application and type su. When asked, give the password you used when installing Mac OS X. If it says sorry and you’re sure you typed in the password then you have to enable root by
a. Launch Applications / Utilities / NetInfo Manager (in the Finder)
b. Pick menu item Domain / Security / Authenticate…
c. When asked, give the password you used when installing Mac OS X.
d. Pick menu item Domain / Security / Enable Root User
e. When asked, give the password you used when installing Mac OS X.
Now type su to become the root user (the superuser).
Prepare the Tomcat environment
Other UNIXes store their Java tools in a directory called bin (for binaries); Mac OS X stores them in “Commands”. Make a symbolic link to have Tomcat see the contents of Commands when it looks in bin by typing:
ln -s Commands bin
Type exit to leave the superuser subshell you created when you typed “su”.
Change directory to the tomcat directory by typing
Start Tomcat by typing bin/startup.sh; it should quickly start. Point your web browser to the URL
you should see the friendly tomcat icon and a welcome message. If you don’t, then type cat logs/catalina.out to check for errors which happened during startup. (To stop Tomcat type: bin/shutdown.sh in the same directory.)
To run your servlets compile them into .class files and put them into the /Applications/tomcat-4.0-b1/webapps/ROOT/WEB-INF/classes directory. (If the classes folder isn’t there the command mkdir classes will create it.) To see your servlet in action point your browser to the URL
(YourServlet being the example for a servlet YourServlet.java, which compiled into YourServlet.class).
If you are using JARs for your support files put them into the /Applications/tomcat-4.0-b1/lib directory and Tomcat will automatically add their contents to its classpath.
If your java classes need to read properties files put them into the /Applications/tomcat-4.0-b1 directory, Tomcat’s home.
Start Tomcat automatically each time Mac OS X boots
If you want Tomcat to start up each time you reboot Mac OS X then you’ll want to read the
Geek Times copyright information
This page, http://www.GeekTimes.com/macintosh/osx/and/apache/jakartaTomcat/install.html, is
1993-2001 by , all rights reserved.
Questions and comments? Send
to the Geek Times Webmaster.
Web space graciously donated by , an Internet Service Provider in .