How to Always Keep a Program Running in Mac OSX

With IOS 5, you can now automatically sync your iPhone over the air, if your iPhone is plugged into a charging device and is on the same wifi network as the computer with your iTunes library.  I really like this feature.  I listen to a lot of podcasts, some of which come out daily.  So, with over-the-air syncing, now I don’t have to plug my iPhone into my computer every day to make sure I’ve got my latest podcasts.  I shouldn’t even need to touch that computer, but when I wake up in the morning and unplug my iPhone from its charger on my nightstand I am ready to go and can listen to that first podcast while I’m getting showered and dressed.  That is unless iTunes is not running.  Many times I have gotten up and a new podcast was not waiting for me.  And it is universally because iTunes was closed.  Now I need to open iTunes and wait for it to check for new podcasts and download then and then sync my iPhone.  Many wasted minutes and my day is off to a poor start.  So, how can I make sure that iTunes stays open?

I got this procedure from this MacWorld forum post.

If you have iTunes set to open on login, deselect that.  This will take care of it.

Create the following plist file in the LaunchAgents folder of your home Library (~/Library/LaunchAgents) with the name user.launchkeep.itunes.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>user.launchkeep.itunes</string>
  <key>KeepAlive</key>
  <true/>
  <key>Program</key>
  <string>/Applications/iTunes.app/Contents/MacOS/iTunes</string>
</dict>
</plist>

Load this launchd job by running the following command in Terminal:

launchctl load ~/Library/LaunchAgents/user.launchkeep.itunes.plist

Now if you quit iTunes it will start right back up.  In order to quit the app at any time other than logout or shutdown you’ll need to disable the job.  To do that run the following comman in Terminal:

launchctl remove user.launchkeep.itunes

Leave a Reply

Your email address will not be published. Required fields are marked *

Skip to content