I thought I’d post up my solution to auto-starting XAMPP when I turn on my iMac; Although I normally develop on Linux and Windows… I have a nice shiney iMac downstairs of which I’m starting to use more and more for development.
I hope this very quick tutorial is of help to some other people too 🙂
First of all you need to open up the terminal on your MacOSX machine (I’m current using MacOSX 10.7 ‘Lion’)
At the terminal enter the following comamnds:-
cd /Library/StartupItems sudo mkdir xampp cd xampp/ sudo nano xampp
When Nano opens up, you should populate the file with the following:-
#!/bin/sh /Applications/XAMPP/xamppfiles/xampp start
If you installed XAMPP elsewhere you will need to modify the path above.
You can also start specific xampp apps for example, starting apache only by using /Applications/XAMPP/xamppfiles/xampp startapache instead.
sudo nano StartupParameters.plist
Again, we need to populate the file with the following contents:-
<?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE plist SYSTEM “file://localhost/System/Library/DTDs/PropertyList.dtd”> <plist version=”0.9″> <dict> <key>Description</key> <string>XAMPP</string> <key>OrderPreference</key> <string>Late</string> <key>Provides</key> <array> <string>Starts Apache and MySQL</string> </array> <key>Uses</key> <array> <string>SystemLog</string> </array> </dict> </plist>
Last of all, now we just need to set a few permissions etc. on the new files we’ve created…
cd .. sudo chown -R root xampp sudo chgrp -R wheel xampp sudo chmod 755 xampp/xampp
That it, to test it out, restart your Mac, login and try to access http://localhost from your browser…. You should find that XAMPP is now automatically started 🙂