-
-
Save emiller42/4982462 to your computer and use it in GitHub Desktop.
1) Install MAMP normally | |
2) Download the latest binary of tomcat from http://tomcat.apache.org/ and extract it into the MAMP folder | |
(you should now have a /Applications/MAMP/apache-tomcat-version folder) | |
3) Create a link to the apache-tomcat folder: | |
ln -s /Applications/apache-tomcat-7.0.37/ tomcat | |
4) Make sure all the binaries are executable: | |
cd /Applications/tomcat/bin | |
ls -1 *.sh | xargs chmod +x | |
5) Modify /Applications/MAMP/bin/startApache.sh and add the following to the end: | |
/Applications/MAMP/tomcat/bin/startup.sh | |
6) Modify /Applications/MAMP/bin/stopApache.sh so it reads: | |
# /bin/sh | |
/Applications/MAMP/tomcat/bin/shutdown.sh | |
/Applications/MAMP/Library/bin/apachectl stop | |
sleep 2 | |
kill -TERM ps aux | grep [t]omcat | awk '{ print $2}' | |
sleep 1 | |
kill -9 ps aux | grep [t]omcat | awk '{ print $2}' | |
Done! | |
Here are some similar but slightly simpler instructions (found at http://lingxiao216.blogspot.com/2011/05/add-tomcat-into-mamp-not-mamp-pro.html). Just in case someone comes across this page with little knowledge or prior experience, like me :)
Add Tomcat into MAMP (Not MAMP Pro)
- Download tomcat.
- Assuming the default MAMP location:
cd /Applications/MAMP
mv ~/Downloads/apache-tomcat-whateverversion.tar.gz
tar xf apache-tomcat-whateverversion-tar.gz
mv apache-tomcat-whateverversion tomcat
- With you favorite editor from the /Applications/MAMP/bin open the startApache.sh file and add this line to >the end:
/Applications/MAMP/tomcat/bin/startup.sh
- In the same directory open the stopApache.sh file and add this line:
/Applications/MAMP/tomcat/bin/shutdown.sh
before the
/Applications/MAMP/Library/bin/apachectl stop
line.
This makes tomcat start when you run Apache from the MAMP control panel, and stop when Apache is >stopped.
Add these 4 lines, that use force:
sleep 2
kill -TERM ps aux | grep [t]omcat | awk '{ print $2}'
sleep 1
kill -9 ps aux | grep [t]omcat | awk '{ print $2}'to the end of stopApache.sh.
They give Tomcat 2 seconds (quite enough, I think), and then are so kind to terminate it instead of killing (so, >the force shouldn’t be considered dark). But if it’s so rude not to terminate, they kill him – fair enough, I think.
Make sure, you have installed Java, else Tomcat will not work.
You can download and install Java from following URL
https://www.java.com/en/download/
On what port tomcat will run?
in step 2 i think you meant
ln -s /Applications/MAMP/apache-tomcat-version tomcat
(assuming pwd is/Applications
)then in step 5: add
/Applications/tomcat/bin/startup.sh
to the end. ditto for step 6