Installing Tomcat on Mac

Introduction

Tomcat is a Java Servlet container and has gained much popularity in recent times among web developers. Tomcat’s ability to sustain and efficiently run heavy load-intensive applications coded in the Java platform has made it so common among developers. The inspiration behind the name of the project ‘Tomcat’ comes from an animal’s innate tendency to fend for itself and survive irrespective of the circumstances. The latest version of the application is Tomcat 9 and it installs various Java EE (Enterprise Editions) specs like Java Servlet, Java EL, WebSocket, JavaServer Pages, etc. In this article, we will discuss how to download Tomcat on Mac devices.

Prerequisite

As a prerequisite, you need to have either a JDK or a JRE installed on your device before you download any version of Tomcat. The latest version of Tomcat, 9.0, is supported on Mac devices. A recommended JDK would be the AdoptOpenJDK. It is open-source and one of the best development kits currently.

Steps to Install Tomcat on Mac

  1. Open your web browser and go to the following link: https://tomcat.apache.org/download-90.cgi.
  2. Navigate to the left panel and click on Tomcat 9. Once the page loads up, download tar.gz under the ‘Binary Distributions / Core’ section. Unzip the download file and extract all the files to a new folder.
  3. Open the terminal from your Mac device and type in the following commands:
    sudo mkdir -p /usr/local
    sudo mv ~/Downloads/apache-tomcat-9.0.35 /usr/local
  4. As Apache produces new versions of Tomcat in short time intervals, we can set the application in a way such that newer versions can easily be replaced with the old ones. Type out this code in the terminal window:
    sudo rm -f /Library/Tomcat
    sudo ln -s /usr/local/apache-tomcat-9.0.35 /Library/Tomcat
  5. Edit the ownership to your name:
    sudo chown -R <your_username> /Library/Tomcat
  6. This will make all the scripts executable: sudo chmod +x /Library/Tomcat/bin/*.sh

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.