4

I'm trying to load my daemon-app with this command

launchctl load /Library/LaunchDaemons/myPlistFileName

It works fine, but only while my user is logged in on system.

How can I load my deamon-app, which will stay loaded without any user logged into the system (like the windows-services)??

The command

sudo launchctl load /Library/LaunchDaemons/myPlistFileName

give me an error -> nothing found to load

Which is the right way to do this?

3 Answers 3

5

In order to load the job for everyone you need to run launchctl under root privileges. If the job is already loaded under your user account, it won't load using root privileges instead.

Try running launchctl unload /Library/LaunchDaemons/myPlistFileName first before running sudo launchctl load -w /Library/LaunchDaemons/myPlistFileName. Take a look at the output in system.log (you can view it using Console.app if you'd prefer) that occurs when you load the daemon.

1
  • Was stuck on this one. Thanks. The man page says the -w clears the Disabled key which has been moved outside the plist.
    – geekinit
    Jan 10, 2013 at 2:40
0

If you can't seem to run

sudo launchctl load /Library/LaunchDaemons/myPlistFileName

try to switch to the root user first:

sudo su

It will ask you for a password - enter your standard user' password, and you will now be using the terminal under the root account.

Than, run the

launchctl load /Library/LaunchDaemons/myPlistFileName

command.

0

I was still having issues after trying this. The solution for me was:

sudo launchctl load -F /Library/LaunchDaemons/myPlistFileName

After this, I was able to load and unload it as much as I wanted.

You must log in to answer this question.