[launchd-dev] Stopping and uninstalling a LaunchDaemon job

Shawn Erickson shawnce at gmail.com
Wed Aug 27 08:08:01 PDT 2008


Looking for opinion on the best way to manage the uninstall of a
launchd job that lives under /Library/LaunchDaemon. The uninstall
process is currently planned to be triggered by an button/option
displayed on one of the tabs of our system preferences plug-in. If the
user clicks this we get authorization rights and attempt to do the
uninstall that is needed.

We have no issues using the rights we are granted to remove files
owned by root, etc. but we cannot use launchctl to stop the
LaunchDaemon because the uninstall task runs as the current user and
not as root (aka doesn't see the top level launchd instance).

Note this is a temporary issue in an alpha version of our product
since we plan to begin utilizing an IPC mechanism to have our
preference plug-in, etc. connect with our launch daemon. When this is
up an going we can message the daemon directly to get it to do aspects
of the uninstall and shutdown (since it is running as root).

In other words this is just a quick uninstall solution for alpha and
something that will be replaced... so not looking for something to
fancy.

-Shawn


More information about the launchd-dev mailing list