install brew
Open a terminal and enter the following command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Search for the tomcat version and enter the following command:
brew search tomcat
Install the version you want, for example, install tomcat@9 here
brew install tomcat@9
If you encounter an error, you can solve it according to the Error prompt
For example, common errors:
Here, install the relevant dependencies according to the prompts brew install openjdk
and then run the command to install tomcat again
Verify that the installation was successful:
It is displayed and installed here, if you need to reinstall, uninstall and reinstall
Two ways to run the tomcat server
elegant way
启动:catalina start
停止:catalina stop
Usehomebrew services
启动:brew services start tomcat@9
停止:brew services stop tomcat@9
After the startup is successful, open the browser to visit http://localhost:8080, and the following interface will appear to indicate that the installation is successful
Configure tomcat in IDEA
Enter the following command in the terminal to get the tomcat path
brew ls tomcat@9
Open IDEA and find the edit configuration in run
Click on the upper left corner ➕ and select the tomcat server. Note: not tomee
configuration complete
If you have any questions, please leave a message in the comment area to discuss