http://blog.csdn.net/chenlia/article/details/7692361
Download the full. gz file package for MAC version to the official Apache homepage. Unzip the copy to the/library directory.
1. How the Finder opens the library in Mac
New Finder Window Press SHIFT +command+g Enter/library to enter the hidden directory.
PS: This shortcut key is very useful, be sure to remember!
2. Modify Directory Permissions
Select Folder Command+i Open Introduction, modify file Permissions command sudo chmod 755/library/tomcat (give a 777 permission also does not matter)
To install Tomcat:
Download the latest Tomcat binary code package on the Apache website: (Be careful not to download the installation package for Windows) http://tomcat.apache.org/(Mac is. gz)
When you're done downloading, unzip and name the folder Tomcat
Move the renamed folder to the root directory /library (available elsewhere), and the installation process is complete.
Perform /library/tomcat/bin under startup.sh, and then open http://localhost:8080 to see if Tomcat is started, to stop the server from running in the same directory as the shutdown.sh
If you encounter problems such as the inability to find directories and file places, it is generally because the file permissions are causing problems that you can resolve:
sudo chmod 755/library/tomcat/bin/*.sh
sudo chmod 755/library/tomcat/bin/*.bat
Meet "Java_home not defined" JAVA path undefined error, execute the following command in Terminal:
sudo setenv java_home/library/java/home
To configure the Tomcat startup script:
Use the text editor to add the following code:
#!/bin/bash
Case $ in
Start
sh/library/tomcat/bin/startup.sh
;;
Stop
sh/library/tomcat/bin/shutdown.sh
;;
Restart
sh/library/tomcat/bin/shutdown.sh
sh/library/tomcat/bin/startup.sh
;;
*)
echo "Usage:start|stop|restart"
;;
Esac
Exit 0
Save the file as Tomcat, lowercase with no suffix. Give File Execution permissions:
chmod 777 Tomcat
。 Place this file in the path contained in the terminal, such as/usr/bin, and then simply enter Tomcat start and Tomcat stop in the terminal to enable Tomcat.
The shortcut commands are as follows:
1) Tomcat start
2) Tomcat stop
3) Tomcat restart
It's very convenient!
Installing Tomcat on a Mac system