Installing Apache Tomcat using Homebrew on OS X Yosemite - mhulse/mhulse.github.io GitHub Wiki

See also: Installing Apache Tomcat on OS X Yosemite


Assuming that Homebrew is already installed/setup.

Run daily boilerplate commands:

$ brew update
$ brew upgrade
$ brew doctor

Next, install Tomcat:

$ brew install tomcat

Reload your profile:

$ source ~/bash_profile

Start or stop Tomcat:

$ catalina start
$ catalina stop

If you don't get any error messages, visit http://localhost:8080 and you should be good to go.

If you see:

Unable to find any JVMs matching version "(null)". No Java runtime present, try --request to install. Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these environment variable is needed to run this program

… then run:

$ java -version
No Java runtime present, requesting install.

Don't click anything. Based on Apple's instructions, they suggest you visit:

https://www.java.com/en/

… and download/install Java. I only point this out because the $ java -version command takes you to a different URL; I'm sure they are the same, but I'll follow Apple's URLs just because I'll know who to blame if shit hits the fan. :wink:

Add this to your .bash_profile:

export JAVA_HOME='/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home'

Reload your profile (or, restart computer):

$ source ~/.bash_profile

Now, if you reload your shell and run:

$ java -version

… you'll get the same message, but Tomcat should run now:

$ catalina start

View available commands:

$ catalina -h