Friday, March 11, 2011

How to run Mac OS X application at system startup

1. Create a text file with .plist extension (for example, com.myname.myapplication.plist) with the following content:

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

2. Replace strings in bold with your application id (can be any unique string) and path to your application executable.

3. Put it to /Library/LaunchAgents directory:

sudo cp com.myname.myapplication.plist /Library/LaunchAgents

4. Change file permissions to 644:

sudo chmod 644 com.myname.myapplication.plist

More information:
  • Introduction to System Startup Programming Topics
  • Technical Note TN2083: Daemons and Agents
  • launchd.plist(5) Mac OS X Manual Page
  • launchctl(1) Mac OS X Manual Page
  • No comments:

    Post a Comment