Logo
Published on

Install Apache Tomcat on OS X

Authors

Install Apache Tomcat on OS X

Prerequisite: Java

First of all, is there any java on your Mac ? The latest version is available for download here: http://www.oracle.com/technetwork/java/javase/downloads/

The JDK installer package come with a dmg so it install easily on OS X; open the Terminal app,

java -version

now shows something like this:

java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

##Installing Tomcat

Here are the easy to follow steps to get it up and running on your Mac

Download a binary distribution: apache-tomcat-8.0.23.tar.gz from here.

Opening the file is unarchiving the archive so it creates a folder structure in your Downloads folder.

~/Downloads/apache-tomcat-8.0.23

Open a Terminal to move the unarchived distribution to /usr/local

Check /usr/local exists, and if you need to create it: sudo mkdir -p /usr/local

sudo mv ~/Downloads/apache-tomcat-8.0.23 /usr/local

Now we are going to create a symbolic link to Tomcat:

sudo ln -s /usr/local/apache-tomcat-8.0.23 /Library/Tomcat

Starting Tomcat

tsamaya:~ $ sudo /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/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
Using CLASSPATH: /Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar
Tomcat started.

if scripts are not executable, make all scripts executable:

sudo chmod +x /Library/Tomcat/bin/*.sh

After starting Tomcat, open a browser and have a look at the default page: http://localhost:8080

! startup page

Stopping Tomcat

tsamaya:~ $ sudo /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/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
Using CLASSPATH: /Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar

resources