Apache Tomcat, Apple, and Homebrew logos, illustrating installing Apache Tomcat on macOS with Homebrew
Back to Blog
DevOps & Infrastructure
November 20, 2019
Fahim Hossain

Installing Apache Tomcat on MacOS Mojave using Homebrew

How to install Apache Tomcat on macOS using Homebrew, starting with the Java Development Kit check that trips up most first attempts.

Apache Tomcat, Apple, and Homebrew logos, illustrating installing Apache Tomcat on macOS with Homebrew

In order to install Apache Tomcat on MacOS, we firstly need to install Java Development Kit(JDK). To check if java installed, open up the terminal and run the following command:

java -version

If the JDK is not installed, then you will be prompted with the following message

No Java runtime present, requesting install.

On the other hand, if JDK is installed, you will be promoted a message which will look similar to the following:

openjdk version "12.0.2" 2019-07-16
OpenJDK Runtime Environment (build 12.0.2+10)
OpenJDK 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)

Installing JDK on Mac OS using Homebrew

(If JDK is installed on your system, then please skip to the next section.)

Please make sure Homebrew package manager is installed on your system. For instructions to install Homebrew please read the official documentation here.

Step 1: Install Homebrew Cask

Homebrew Cask extends Homebrew and allows you to install large binary files via the Mac terminal. JDK can be installed onto your Mac using Homebrew Cask.

In order to install Homebrew Cask, please type in the following commands onto the terminal sequentially

brew update
brew tap caskroom/cask

Step 2: Install JDK with Homebrew Cask

Run the following command to install the latest version of JDK onto your system:

brew cask install java 

Now, please check if Java is installed on your system by running the following command:

java -version

You will be promoted a message which will look similar to the following:

openjdk version "12.0.2" 2019-07-16
OpenJDK Runtime Environment (build 12.0.2+10)
OpenJDK 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)

Installing and Running Apache Tomcat on Mac OS using Homebrew

Step 1: Install Apache Tomcat

Run the following commands on the terminal in order to install Apache Tomcat:

brew update
brew install tomcat

Step 2: Run Apache Tomcat

Apache Tomcat can be run on Mac OS in two separate ways.

1. Start Tomcat automatically at Mac Login:

brew services start tomcat

In order to stop Tomcat to start automatically at Mac Login:

brew services stop tomcat

2. Start Tomcat manually:

catalina start

In order to stop Tomcat manually:

catalina stop

To view available options on Tomcat run:

catalina -h

Thats it!

I hope this article has been to some aid to you. Would really love to hear from you!

Running infrastructure like this in production? ARITS does platform engineering and CI/CD so your team can ship without babysitting servers.

Need extra engineers, or a team to run the build?

Tell us the shape of the work and your deadline. You will get a straight read on what it takes and what it will cost, from a team that has shipped 400+ projects out of Dhaka and London.

Cookies

We use cookies to see how people find this site and to measure our ads. You can turn those off — everything here still works. Privacy policy

Necessary

Keeps the site working and remembers this choice.

Always on

Analytics

Anonymous stats on which pages get read, so we know what to write next.

Marketing

Lets us measure which ads brought someone here.