- Joined
- Nov 11, 2009
- Messages
- 2
- Reaction score
- 0
- Points
- 1
hello,
i have to create a daemon on a Mac OSX. the daemon must start when the Mac boots up. i have therefore wrote a daemon (using RealBasic), and also wrote a plist file which points to the daemon. everything has been running just fine on Mac OSX 10.4 for months. Now i have copied everything to Snow Leopard 10.6 and am having a small problem. let me explain what i have done so far.
1) i have created a plist file, called "myTestDaemon.plist", which lives in system/library/launchdaemons. the file is exactly this:
2) as the above file describes, i have put the daemon, called "myNewTestDaemon", inside /Users/Paul/Desktop/RealBasic_Projects/My_Application
3) i can then start the daemon using one of two methods - either by rebooting the Mac, in which case the launchd system tool automatically starts the daemon, or by starting the daemon manually using launchctl:
once i do either of the two above methods, i can verify that the daemon is started by doing:
and this shows that myTestDaemon.plist is indeed running.
now, i have done exactly the same thing on my shiney new Mac mini with Snow Leopard on it, but when i do the "launchctl load ...." command, it gives me an error:
after a bit of snooping on the net i found that some people were saying that i have to add a "-F" flag to the command, so now it reads:
apparantly, all plists have a default key called "Disabled", which, if you do not explicitly set to false, is set to true by default. setting the -F flag tells launchctl to ignore this Disabled key, which effectively makes Disable=false. so, i tried the above command with the -F flag and sure enough, this time my daemon started.
so i then explicitly added the key to my plist:
surely this should have the same affect ? apparantly not, because i still get the orginal "nothing found to load" error when i do the "launchctl load...." (without the -F flag). in addition, the daemon still does not start when the Mac boots up. and this is my problem.
like i say, this was all working in 10.4, and now not working in 10.6. So i imagine something has changed between version ? does my plist file look right ? all i need the daemon to do is start up at boot time.
hope i have explained it well. if not please ask for more info.
any help appreciated.
i have to create a daemon on a Mac OSX. the daemon must start when the Mac boots up. i have therefore wrote a daemon (using RealBasic), and also wrote a plist file which points to the daemon. everything has been running just fine on Mac OSX 10.4 for months. Now i have copied everything to Snow Leopard 10.6 and am having a small problem. let me explain what i have done so far.
1) i have created a plist file, called "myTestDaemon.plist", which lives in system/library/launchdaemons. the file is exactly this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>myNewTestDaemon</string>
<key>ProgramArguments</key>
<array>
<string>/Users/Paul/Desktop/RealBasic_Projects/My_Application</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
2) as the above file describes, i have put the daemon, called "myNewTestDaemon", inside /Users/Paul/Desktop/RealBasic_Projects/My_Application
3) i can then start the daemon using one of two methods - either by rebooting the Mac, in which case the launchd system tool automatically starts the daemon, or by starting the daemon manually using launchctl:
Code:
sudo launchctl load /system/library/launchdaemons/myTestDaemon.plist
once i do either of the two above methods, i can verify that the daemon is started by doing:
Code:
sudo launchctl list
and this shows that myTestDaemon.plist is indeed running.
now, i have done exactly the same thing on my shiney new Mac mini with Snow Leopard on it, but when i do the "launchctl load ...." command, it gives me an error:
Code:
"nothing found to load"
after a bit of snooping on the net i found that some people were saying that i have to add a "-F" flag to the command, so now it reads:
Code:
sudo launchctl load -F /system/library/launchdaemons/myTestDaemon.plist
apparantly, all plists have a default key called "Disabled", which, if you do not explicitly set to false, is set to true by default. setting the -F flag tells launchctl to ignore this Disabled key, which effectively makes Disable=false. so, i tried the above command with the -F flag and sure enough, this time my daemon started.
so i then explicitly added the key to my plist:
Code:
<key>Disabled</key>
<false/>
surely this should have the same affect ? apparantly not, because i still get the orginal "nothing found to load" error when i do the "launchctl load...." (without the -F flag). in addition, the daemon still does not start when the Mac boots up. and this is my problem.
like i say, this was all working in 10.4, and now not working in 10.6. So i imagine something has changed between version ? does my plist file look right ? all i need the daemon to do is start up at boot time.
hope i have explained it well. if not please ask for more info.
any help appreciated.