How to install and configure Apache Tomcat 7 on Mac OS

Apache is the most widely used web server software which is developed and maintained by the Apache Software Foundation. It is an open source software. Apache Tomcat is used to deploy Java Servlets and JSPs. So basically Apache is an HTTP Server, serving HTTP. Tomcat is a Servlet and JSP Server serving Java technologies.

Install Apache Tomcat 7 server

1st Step: Go to  ⇒ Download ⇒ Tomcat 7.0 ⇒ 7.0.{xx} (where {xx} denotes the latest release) ⇒ Binary distribution ⇒ Core.

Download the “tar.gz” package (e.g., “apache-tomcat-7.0.{xx}.tar.gz“). Next extract the tar.gz folder to the apache-tomcat-7.0.{xx} folder. Rename the folder to “tomcat” and copy the extracted folder.

Go the Applications folder, and paste the tomcat folder.

Configure the Apache Tomcat server

The following files in the /Applications/tomcat/conf folder will be edited in order to configure the server.

  • web.xml
  • context.xml
  • server.xml

Set the TCP Port number

The /Applications/tomcat/conf/server.xml file will be edited to change the port number which runs the apache tomcat server. The default port number the server runs is 8080. This can be run on the default port number if no other application is running on this port. If not you can change the port number by replacing 8080 as follows in the server.xml file (around Line 69).

<Connector port="9999" protocol="HTTP/1.1"
           redirectPort="8443" />

You may choose any number between 1024 and 65535.

Enabling Directory listing

In order to enable directory listing the /Applications/tomcat/conf/web.xml file needs to be edited as follows. Change the value “false” to “true” in the parameter value under listings (around line 103).


Enabling Automatic Reload

Change the /Applications/tomcat/conf/context.xml file (around line 19) as follows. Insert the reloadable=”true” statement inside the context tag.

<Context reloadable="true">

The configuration of the Apache Tomcat server is complete.

Start the Apache Tomcat server

To start the Apache Tomcat server, open a new terminal and change the working directory as follows.

cd /Applications/tomcat/bin

Next type the following command in order to start the server.

sudo ./ run

If you receive an error saying “command not found” or “cannot start server”, do the following to change the permissions of the file. This should have execute permissions for the server to start.

sudo chmod +x
sudo chmod +x

Next run the following command again to start the server.

sudo ./ run

Now the server should start correctly and the terminal should display a message saying “Tomcat started”.


Thank You!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at

Up ↑

%d bloggers like this: