How do I Start Application Services with launchctl When Apple Mac Leopard Boot Up

If you have MySQL, PostgreSQL, Apache2 or other application installed from Macports, you might want the services auto start during machine start up. You can use launchctl to do it, it’s similar to start up script on FreeBSD on /usr/local/etc/rc.d or /etc/rc.d

The start up script is located at /Library/LaunchDaemons, this is what I have on my machine;

In order to add the services into launchctl, do it with below command;

Auto start MySQL

sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist

Auto start PostgreSQL

sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql82-server.plist

Auto start Apache2 Web Server

sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist

To disable the service auto start;

sudo launchctl unload -w /Library/LaunchDaemons/org.macports.apache2.plist

For more information, do man launchctl