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
Related posts:
- Install MySQL5 Server on Apple Mac Leopard with MacPorts Previously I wrote a post on “installing postgresql 8.2 on...
- MySQL 5 Server Cannot Start on Apple Mac Leopard There were some problem during configuring MySQL5 Server on Leopard...
- postgresql82-server compile error on Apple Leopard with Macports 1.5 I wasn’t able to compile postgresql82-server on my machine, it’s...
- installing postgresql 8.2 on Leopard with macports postgresql! one of my favorite high performance open source db,...
- Install MySQL5 on Mac OSX With Darwin Port Before installing MySQL5, please be sure you have Darwin Port...
- Problem Upgrade Apache2 on MacPorts I was trying to upgrade apache2 on my Macports but...
- Apple Mac Startup Scripts – launchd Wonder how does Apple Mac machine start up background services...
- PostgreSQL Database signal 6 Error On Apple Mac After I have done PostgreSQL upgrade through MacPort, the database...
- MySQL Cannot Connect with PHP in OSX I think some of you might have problem connecting to...
- How to Flush DNS Cache in Apple Mac OSX Leopard Many of you might not know that beside Microsoft Windows...