DEV Community

Tony Huang
Tony Huang

Posted on

How to install Tomcat on MacOS

This is my first post, this post not very special, you maybe can find the same tutorial on other website, it just a note for someone maybe with same problem with me.

Tomcat website provides different build for Windows, but there is no build for MacOS and also no installation for MacOS. So, this post will teach you how to install Tomcat and run it up on MacOS.

Download Tomcat for MacOS

For MacOS, you have to download Core > tar.gz and unzip it. (you can choose which version you want)

Create Tomcat folder

I recommend create under your current user not put into system folder, because you may deploy the code into Tomcat folder frequently when development. So, it will prevent you always need root permission to change the file.

mkdir -p /User/{current user}/Library/Tomcat

Move Tomcat into that folder

After you unzip Tomcat, you will get a folder, for my example, I'm using version 7.0.92, so, the folder name is apache-tomcat-7.0.92.

mv ./apache-tomcat-7.0.92 /User/{current user}/Library/Tomcat/

Make all scripts executable

There is some scripts file we will execute later, e.g.: start or stop script, we need to make them executable.

chmod +x /User/tony/Library/Tomcat/apache-tomcat-7.0.92/bin/*.sh

Starting Tomcat

After you make all scripts executable, now you can start your Tomcat using:

/User/tony/Library/Tomcat/apache-tomcat-7.0.92/bin/startup.sh

Now you should be able to access http://localhost:8080/.

Stopping Tomcat

If you want to stop your Tomcat, can use:

/User/tony/Library/Tomcat/apache-tomcat-7.0.92/bin/shutdown.sh

That's it, hope this post can help someone in the future.

Top comments (0)