A Beginner’s Guide: Installing Apache Tomcat on Your Mac

Rajendhar Alluri
3 min readAug 28, 2023

--

Are you ready to take the first step in web development and learn how to install Apache Tomcat on your Mac? This guide will walk you through the process in a simple and easy-to-follow manner. Let’s get started on this exciting journey!

Step 1: Check Your Java Version

Before installing Apache Tomcat, ensure you have Java installed on your Mac. Open your Terminal and type:

java -version
java -version

java version "1.8.0_281"
Java(TM) SE Runtime Environment (build 1.8.0_281-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)

If Java is not installed, download and install it from the official Oracle website.

Step 2: Download Apache Tomcat

Visit the official Apache Tomcat page (https://tomcat.apache.org/) and choose the version you want to install. For beginners, the latest stable version is recommended. Download the zip file or tar file.

Step 3: Extract the Tomcat Archive

Once the download is complete, navigate to your Downloads folder and extract the downloaded archive. You can do this by double-clicking on the downloaded file or by using the Terminal:

tar -xzvf apache-tomcat-xx.x.x.tar.gz
tar -xzvf /Users/rajendhar/Downloads/apache-tomcat-10.1.13.tar.gz  
x apache-tomcat-10.1.13/conf/
x apache-tomcat-10.1.13/conf/catalina.policy
x apache-tomcat-10.1.13/conf/catalina.properties
x apache-tomcat-10.1.13/conf/context.xml
x apache-tomcat-10.1.13/conf/jaspic-providers.xml
x apache-tomcat-10.1.13/conf/jaspic-providers.xsd
.
.
.

Step 4: Move Tomcat to a Preferred Location

Move the extracted Tomcat folder to a location where you’d like to store it permanently. For instance, you can move it to the /usr/local directory:

sudo mv apache-tomcat-xx.x.x /usr/local
sudo mv /Users/rajendhar/Downloads/apache-tomcat-10.1.13 /Users/rajendhar

Step 5: Change the permission then Make the file executable

cd /apache-tomcat-10.1.13/bin
ls -al *.sh

There is no executable permissions for the .sh files. So we will change this permission by using below command.

chmod +x *.sh

You just need to give a chmod here and then +x. +x is going to make this file executable. If you want to make all .sh files so just give *.sh.

Now, you can see there is an x flag added to these files.

Step 6: Start the Tomcat by ./startup.sh

There are two files which are important one is the startup.sh to start the Tomcat and other is the shutdown.sh to shut down the Tomcat server.

rajendhar@192 bin % ./startup.sh

Using CATALINA_BASE: /Users/rajendhar/apache-tomcat-10.1.13
Using CATALINA_HOME: /Users/rajendhar/apache-tomcat-10.1.13
Using CATALINA_TMPDIR: /Users/rajendhar/apache-tomcat-10.1.13/temp
Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_281.jdk/Contents/Home
Using CLASSPATH: /Users/rajendhar/apache-tomcat-10.1.13/bin/bootstrap.jar:/Users/rajendhar/apache-tomcat-10.1.13/bin/tomcat-juli.jar
Using CATALINA_OPTS:

Tomcat started.

rajendhar@192 bin %

Now how to check whether Tomcat is properly started or not. Just go to any browser and write localhost:8080. The port 8080 is the default port for the Tomcat to start.

Step 7: Stop the server

To stop the tomcat server just need to run the stop script ./shutdown.sh


rajendhar@192 bin % ./shutdown.sh

Using CATALINA_BASE: /Users/rajendhar/apache-tomcat-10.1.13
Using CATALINA_HOME: /Users/rajendhar/apache-tomcat-10.1.13
Using CATALINA_TMPDIR: /Users/rajendhar/apache-tomcat-10.1.13/temp
Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_281.jdk/Contents/Home
Using CLASSPATH: /Users/rajendhar/apache-tomcat-10.1.13/bin/bootstrap.jar:/Users/rajendhar/apache-tomcat-10.1.13/bin/tomcat-juli.jar

Congratulations! You’ve successfully installed Apache Tomcat on your Mac. You’re now ready to begin your web development journey using this powerful server.

Remember, practice makes perfect. Experiment with Tomcat, explore its features, and start creating your web applications. Happy coding!

--

--

Rajendhar Alluri
Rajendhar Alluri

Written by Rajendhar Alluri

👨‍💻 Rajendhar Alluri, Senior Technical Specilasit have 10+ experience | Passionate about Tech and Innovation 💡 | Writing to Inspire and Empower Developers 📝