How to install Apache Tomcat on macOS 10.14 Mojave

In this article, I will explain you how to install and run Apache Tomcat on macOS 10.14 Mojave. If you want to read more about Apache Tomcat, you can do so on their website or on Wikipedia.
Prerequisite
Tomcat 9.x requires Java 8 or later.
You can verify if you have Java and what version, by running the following command in your terminal:
java -version
If you do not Java installed, or below version 8, you can use Homebrew to install Java on your Mac, or update to a higher version.
Installing Tomcat: step by step
- Download a binary distribution of the core module
apache-tomcat-9.0.12
from this page in your Downloads folder. For example thetar.gz
under the Core section; - Open/unarchive the archive. Notice that a new folder structure in your Downloads folder is created:
~/Downloads/apache-tomcat-9.0.12
- Open terminal and move the unarchived distribution to
/usr/local
, by running the following commands:sudo mkdir -p /usr/local sudo mv ~/Downloads/apache-tomcat-9.0.12 /usr/local
- Think ahead! There will be future releases. So we are going to create a symbolic link that will refer to Tomcat, by running the following commands in terminal:
sudo rm -f /Library/Tomcat sudo ln -s /usr/local/apache-tomcat-9.0.12 /Library/Tomcat
- Change the owner of the
/Library/Tomcat
directory, by running the following command:sudo chown -R YOUR_USERNAME /Library/Tomcat
- Make all scripts executable:
sudo chmod +x /Library/Tomcat/bin/*.sh
Run Tomcat
Once you have successfully installed Tomcat, you can run it:
/Library/Tomcat/bin/startup.sh
By default, you can acces Tomcat in your web by going to localhost:8080
:

You can shutdown Tomcat with:
/Library/Tomcat/bin/shutdown.sh