launchctl unload say: Could not find specified service

8,259

Try removing the sudo and just run:

launchctl unload /System/Library/LaunchDaemons/nginx.plist

When attempting to unload some LaunchDaemons, it will return "Could not find specified service" if using sudo.

Share:
8,259

Related videos on Youtube

Benj
Author by

Benj

Updated on September 18, 2022

Comments

  • Benj
    Benj almost 2 years

    I'm trying to make a plist file in order to start nginx on boot. When starting nginx with launchctl it starts the service. But it cannot unload it, and print "Could not find specified service".

    $ ps aux | grep nginx
    me (...) grep nginx
    
    $ sudo launchctl load /System/Library/LaunchDaemons/nginx.plist 
    (no output)
    
    $ ps aux | grep nginx
    me (...) grep nginx
    nobody (...) nginx: worker process
    root (...) nginx: master process /opt/nginx/sbin/nginx
    
    $ sudo launchctl unload /System/Library/LaunchDaemons/nginx.plist 
    /System/Library/LaunchDaemons/nginx.plist: Could not find specified service
    

    This is the content of /System/Library/LaunchDaemons/nginx.plist

    $ cat /System/Library/LaunchDaemons/nginx.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>nginx</string>
        <key>Program</key><string>/opt/nginx/sbin/nginx</string>
        <key>KeepAlive</key><true/>
        <key>NetworkState</key><true/>
        <key>StandardErrorPath</key><string>/opt/nginx/logs/system.log</string>
        <key>LaunchOnlyOnce</key><true/>
      </dict>
    </plist>
    

    Any help appreciated. Cheers

    • rpbaltazar
      rpbaltazar over 4 years
      Any luck with this? I'm facing it at the moment and can't figure that out either