Tomcat 7 is the first Apache Tomcat release to support the Servlet 3.0, JSP 2.2, and EL 2.2 specifications. Please note that Tomcat 7 requires Java 1.6 or better, but that shouldn’t be a problem, if you are running OS X 10.5 or 10.6.
On OS X 10.7 and 10.8 (Mnt Lion) however, Java is initially not installed anymore. The easiest way to get Java onto your Mac is probably to open the Terminal app and enter java. You will be asked if you want to install it and OS X takes care of the rest – you would end up with Java 6, or you could install Java 7 directly from Oracle.
Whatever you do, when opening Terminal and running java -version, you should see something like this:
java version "1.6.0_37" Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909) Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)
or this:
java version "1.7.0_17" Java(TM) SE Runtime Environment (build 1.7.0_17-b02) Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
Here are the easy to follow steps to get it up and running on your Mac
- Download a binary distribution of the core module: apache-tomcat-7.0.34.tar.gz from here. I picked the tar.gz in Binary Distributions / Core section.
- Opening/unarchiving the archive will create a folder structure in your Downloads folder: (btw, this free Unarchiver app is perfect for all kinds of compressed files and superior to the built-in Archive Utility.app)
~/Downloads/apache-tomcat-7.0.34 - Open to Terminal app to move the unarchived distribution to /usr/local
sudo mkdir -p /usr/local
sudo mv ~/Downloads/apache-tomcat-7.0.34 /usr/local - To make it easy to replace this release with future releases, we are going to create a symbolic link that we are going to use when referring to Tomcat (after removing the old link, you might have from installing a previous version):
sudo rm -f /Library/Tomcat
sudo ln -s /usr/local/apache-tomcat-7.0.34 /Library/Tomcat
- Change ownership of the /Library/Tomcat folder hierarchy:
sudo chown -R <your_username> /Library/Tomcat - Make all scripts executable:
sudo chmod +x /Library/Tomcat/bin/*.sh
Instead of using the start and stop scripts, like so:
Last login: Sun Aug 14 15:20:38 on ttys000
wpbookpro:~ wolf$ /Library/Tomcat/bin/startup.sh
Using CATALINA_BASE: /Library/Tomcat
Using CATALINA_HOME: /Library/Tomcat
Using CATALINA_TMPDIR: /Library/Tomcat/temp
Using JRE_HOME: /Library/Java/Home
Using CLASSPATH: /Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar
wpbookpro:~ wolf$ /Library/Tomcat/bin/shutdown.sh
Using CATALINA_BASE: /Library/Tomcat
Using CATALINA_HOME: /Library/Tomcat
Using CATALINA_TMPDIR: /Library/Tomcat/temp
Using JRE_HOME: /Library/Java/Home
Using CLASSPATH: /Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar
wpbookpro:~ wolf$
you may also want to check out Activata’s Tomcat Controller a tiny freeware app, providing a UI to quickly start/stop Tomcat. It may not say so, but Tomcat Controller works in OS X 10.8.x just fine.
Finally, after your started Tomcat, open your Mac’s Web browser and take a look at the default page: http://localhost:8080


Thanks so much that was great!!!
me sirvió muchísimo tu artículo para la instalación
)
D
Gracias!
Thank You so much for the great tutorial!
Thank you for this tutorial !
To make Tomcat work correctly with Catalina under Lion server 10.7.5, using apache-tomcat-7.0.37 I had to do the following steps.
1-
I had to set the memory to avoid crash. Before that, tomcat was hanging up on a white page
#ADD memory to Tomcat
pico /usr/local/apache-tomcat-7.0.37/bin/catalina.sh
#And add the line bellow to set memory
JAVA_OPTS=”-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m -Dlog4j.debug=true”
#2-
#Then to access Tomcat web GUI though localhost:8080 (or your chosen port) with you web browser.
#Edit
pico /usr/local/apache-tomcat-7.0.37/conf/tomcat-users.xml
# I removed everything and add this.
#It is just working fine now.
#THX
This tutorial is excellent..
Thanks a lot, brilliant job!
Thanks, man!!! Really appreciated it!
Thanks, that works great and I’m using tomcat 7.0.39
I’ve just changed my development platform to Mac OS X and thanks for the detailed tutorial.
This was really helpful.
very useful! Thank you…
Very Helpful.
Thank You! Worked great for Lion
Thanks. This was very helpful.
Thanks a lot…
In my case the server seems to starts but I don’t see the web interface at http://localhost:8080 . I also get a different JRE_HOME after starting:
Amors-MacBook-Air:~ amor$ /Library/Tomcat/bin/startup.sh
Using CATALINA_BASE: /Library/Tomcat
Using CATALINA_HOME: /Library/Tomcat
Using CATALINA_TMPDIR: /Library/Tomcat/temp
Using JRE_HOME: /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
Using CLASSPATH: /Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar
Here is my log from /Library/Tomcat/logs/localhost-2013-06-07.log :
07.06.2013 11:36:18 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
07.06.2013 11:36:18 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
07.06.2013 11:36:18 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded(‘org.apache.jasper.compiler.TldLocationsCache’, ‘org.apache.jasper.compiler.TldLocationsCache@5ebbfa5c’)
07.06.2013 11:55:32 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
07.06.2013 11:55:32 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()