How to install services on OSX   Leave a comment

If you have read the previous post about installing services on Linux (What, you haven’t? Do it now!), you will have a rough idea on how init and the rc.d scripts work. On OSX, launchd is the tool that replaces them both. launchd is invoked by the kernel while booting the system and takes care of managing the processes, just as init does. To interact with launchd there is a tool called launchctl, which will be used in this tutorial.

The daemon scripts are located at /Library/LaunchDaemons. Only the system administrator has the permissions to write there, so take into account that you will need admin rights to follow the next steps.

Write a properties file (which is a type of file with .plist extension that Apple uses for configuration), in/Library/LaunchDaemons. For example, let’s say we want the Drupal Stack to be started at boot time. We would create the file /Library/LaunchDaemons/com.bitnami-drupal.service.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Remember to substitute INSTALLDIR with your current installation path!

When you reboot the machine, the servers will be automatically started. Man, that was easy! If you prefer not to reboot, just use launchctl tool to start the service

launchctl load -w /Library/LaunchDaemons/com.bitnami-drupal.service.plist

To uninstall the service, type

launchctl unload -w /Library/LaunchDaemons/com.bitnami-drupal.service.plist

and delete the properties file


so that it isn’t launched at boot time.

This is the end of the article. If you have comments or suggestions, please post at the following topic on the forums


Posted 2011年11月20日 by gw8310 in mac os


Fill in your details below or click an icon to log in: 徽标

You are commenting using your account. Log Out /  更改 )

Google+ photo

You are commenting using your Google+ account. Log Out /  更改 )

Twitter picture

You are commenting using your Twitter account. Log Out /  更改 )

Facebook photo

You are commenting using your Facebook account. Log Out /  更改 )

Connecting to %s

%d 博主赞过: