Solving launchctl load “nothing found to load” error

Today I was playing with OSX launchctl command, in order to autoload a program using a simple and human-readable XML file (.plist).
Initially my command (sudo launchctl load /path/to/myplist.plist) was giving back an error message “nothing found to load” and I thought it was a bad configuration in the plist, so I checked every path and every settings I specified in it and I realized it was ok… so using the manual (man launchctl) I looked for helpful flags and/or additional help, I then modified the command adding the -F and -w flags and I was able to run my program succesfully. It also started up automatically after a reboot as I wished.
The final command is:

sudo launchctl load -w -F /path/to/myplist.plist

Flags descriptions are the following:

-w Overrides the Disabled key and sets it to false. In previous versions, this option would modify the configuration file. Now the state of the Disabled key is stored elsewhere on-disk.

-F Force the loading of the plist. Ignore the Disabled key.

  • http://gravatar.com/diglincom diglin

    If you have to force the load or unload of a plist file, it means that you have a config which is overrides the plist. This overriding is created when you use the “-w” otherwise otherwise no override will be added to the overrides file.
    To prevent this case, edit the file below, search the job label that you want to remove the override, delete the necessary lines:

    > pico /var/db/launchd.db/com.apple.launchd/overrides.plist

    For example, delete this line
    com.mydomain.myjob

    Disabled

    then you could use: launchctl load or unload /Library/LaunchDaemons/com.mydomain.myjob.plist without the need of “-w” or “-F”

  • thomas

    You wrote “sudo launchtl” but it should be “sudo launchctl”. Somebody could get problems when he copies your paragraph.

  • http://www.daveoncode.com Davide Zanotti

    I fixed the typos, thanks thomas!

  • http://gravatar.com/craiger316 craiger316

    Thanks a bunch! I was having all sorts of problems loading dnsmasq after cleaning my machine and going to Mountain Lion. the dnsmasq plist just refused to load with the same “nothing to load” error. Adding the extra flags to launchctl did the trick.

  • http://gravatar.com/vipinjohney Vipin JOhney

    I have a problem loading launchagent in is all users logged in using fast user switch. The loaded apps of other users appears in the currently active user window. Can somebody help.

  • Activ8

    Thanks Dave, that togehter with another post saveed my day!

  • http://gravatar.com/justinrhopper justinrhopper

    Thanks Dave – I had the -F flag but it appears the -w was key.

  • Carlo

    Thanks for sharing… really got me out of a bind.

  • http://gravatar.com/laeeqhumam laeeqhumam

    nothing worked for me :( I still get same errror. So i was trying to load Citrix com.citrix.AuthManager_Mac.plist inside /Library/LaunchA/
    This does not get triggered unless I reboot.