86

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!

1
  • 10
    I know the answer has been given, but here's the way I found out: after brew install tomcat I did catalina version and found that CATALINA_HOME was set to /usr/local/Cellar/tomcat/<tomcat-version>/libexec.
    – Erik
    Commented May 2, 2017 at 10:48

8 Answers 8

153
brew ls tomcat

This command will show the directory of brew package.

1
  • It was brew ls tomcat@8 in my case. Therefore, the Tomcat Home: /usr/local/opt/tomcat@8/libexec/ Commented Nov 10, 2022 at 17:55
85

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

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

as Tomcat Home in IntelliJ.

26

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/[email protected]/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
1
  • you may need to use /usr/local/opt/tomcat@8/libexec in order to get this to work on intellij Commented Oct 24, 2019 at 18:56
8

It's very simple:

$ catalina home

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

7

You should use:

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

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

3

If installed using brew on Mac M1chip the location of tomcat will be

/opt/homebrew/etc/tomcat
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.