This article is for a developer who has just started using Mac. As with every new Mac user, it took me some time to figure out how to get Apache Tomcat for Java installed on my MacBook. To ease this process for my readers, this article summarises this process to make it easy for you to install Tomcat on your machine.
For Apache Tomcat to be installed, the primary requirement for it run is the JAVA JDK. Latest JDK can be downloaded from the below link:
It’s quite easy process. Just download and double click the .dmg file. To verify your Java installation, go to terminal and write the command
Installing Apache Tomcat on your Mac
- Download the tar.gz binary package from here.
- Unarchive the tar.gz archive to the Downloads folder itself directly.
- Once unarchived, you should have your tomcat installation in ~/Downloads/apache-tomcat-9.0.1 location (the path may vary depending on Tomcat version)
- Move this folder to /usr/local location using the below commands:
12sudo mkdir -p /usr/localsudo mv ~/Downloads/apache-tomcat-9.0.1 /usr/local
- In the future, if ever you wish to upgrade to a newer version, a symbolic link will come in handy. Enter the following commands to get a symbolic link in the library folder.
12sudo rm -f /Library/Tomcatsudo ln -s /usr/local/apache-tomcat-9.0.1 /Library/Tomcat
- Change the ownership of the folder to allow executables to be executed.
1sudo chown -R <your_username> /Library/Tomcat
- Finally, you need to make all the scripts executable.
1sudo chmod +x /Library/Tomcat/bin/*.sh
- Use the startup & stop scripts for starting and stopping the Tomcat server.
12$ /Library/Tomcat/bin/startup.sh$ /Library/Tomcat/bin/shutdown.sh
If you see this on your local browser, you can ascertain that your server is running successfully. Feel free to comment if any further help is required.