How to find out which folder Tomcat is installed by brew on MacOS?

I am learning JSP programing which requires Tomcat. I followed some tutorials but failed to install successfully(Probably some step is not clear match to my situation)

Then I found out you can install easily by this command line:

brew install tomcat

It looks install is successful,

enter image description here

My challenge is after install, I don't know where it is on my hard drive. Therefore, can't configure it in IntelliJ.

enter image description here

My question is:

How do I find out where Tomcat is installed by brew on MacOS?

Thanks!

66027 次浏览
brew ls tomcat

This command will show the directory of brew package.

In case someone else stumbles upon this: I had to select

/usr/local/Cellar/tomcat/<tomcat-version>/libexec

as Tomcat Home in IntelliJ.

Although the answer of cbst is working. I think it is better to choose the dynamic path to tomcat which is located in

/usr/local/opt/tomcat

The configuration that I would suggest is the following two Tomcat application servers:

Configuration

Application Server 01

Name: Tomcat latest
Tomcat Home: /usr/local/opt/tomcat/libexec

Application Server 02

Name: Tomcat X.Y
Tomcat Home: /usr/local/opt/tomcat@X.Y/libexec

Advantage

When you upgrade tomcat using

brew upgrade

Your tomcat servers are likely to keep working. If the latest version is a major release your specific version Tomcat X.Y will not work anymore, which is good as you have confidence you are running a correct tomcat version. To keep working with a specific tomcat version use

brew install tomcat@X

You should use:

/usr/local/Cellar/tomcat@8/<tomcat version>/libexec/

find / -name "webapps"

run the above command on your terminal of mac. And during the search, it should list out the path of your tomcat directory. in my case, it was:

/Users/jayantagarwal/Documents/apache-tomcat-9.0.14/webapps

It's very simple:

$ catalina home

And you'll probably get: /usr/local/Cellar/tomcat/<VERSION_NUMBER/libexec if you installed tomcat via homebrew.

The libraries, tools which are installed through brew.sh are stored in

/usr/local/Cellar
  • in your case you can find tomcat in:
/usr/local/Cellar/tomcat