Mac Launch Daemon Control

Months ago I installed a player for some DRM’ed media from Hiro Media, which was having a noticeable impact on my system. I caught their daemon running in the background consuming ~10% of my CPU when I wasn’t watching any video. I couldn’t find any info on how to get rid of it, and after they didn’t answer my email requesting some information on how to uninstall it, I went and found the process, renamed it, killed it. It didn’t come back.

Today, I was having a look at /var/log/system.log (which you can see through the Console app or just via tail /var/log/system.log in a Terminal window) and I noticed this:

Dec 28 09:04:10 stevemac com.apple.launchd[213] (com.hiro.Daemon): Throttling respawn: Will start in 10 seconds
Dec 28 09:04:20 stevemac com.apple.launchd[213] (com.hiro.Daemon[33542]): posix_spawnp("/usr/libexec/HiroMedia/HiroDaemon", ...): No such file or directory
Dec 28 09:04:20 stevemac com.apple.launchd[213] (com.hiro.Daemon[33542]): Exited with exit code: 1
Dec 28 09:04:20 stevemac com.apple.launchd[213] (com.hiro.Daemon): Throttling respawn: Will start in 10 seconds
Dec 28 09:04:30 stevemac com.apple.launchd[213] (com.hiro.Daemon[33545]): posix_spawnp("/usr/libexec/HiroMedia/HiroDaemon", ...): No such file or directory
Dec 28 09:04:30 stevemac com.apple.launchd[213] (com.hiro.Daemon[33545]): Exited with exit code: 1
Dec 28 09:04:30 stevemac com.apple.launchd[213] (com.hiro.Daemon): Throttling respawn: Will start in 10 seconds

So this thing has been trying to launch every 10 seconds for months now. Time to do something about that.
After a bit of digging I discovered launchctl, the unified launch control tool for the Mac. In a Terminal window, run launchctl, and you get a launchd% prompt:

launchd% help

usage: launchctl [subcommand]
load Load configuration files and/or directories
unload Unload configuration files and/or directories
start Start specified job
stop Stop specified job
submit Submit a job from the command line
remove Remove specified job
bootstrap Bootstrap launchd
list List jobs and information about jobs
setenv Set an environmental variable in launchd
unsetenv Unset an environmental variable in launchd
getenv Get an environmental variable from launchd
export Export shell settings from launchd
limit View and adjust launchd resource limits
stdout Redirect launchd's standard out to the given path
stderr Redirect launchd's standard error to the given path
shutdown Prepare for system shutdown
singleuser Switch to single-user mode
getrusage Get resource usage statistics from launchd
log Adjust the logging level or mask of launchd
umask Change launchd's umask
bsexec Execute a process within a different Mach bootstrap subset
bslist List Mach bootstrap services and optional servers
exit Exit the interactive invocation of launchctl
quit Quit the interactive invocation of launchctl
help This help output

launchd%

Getting rid of this evil daemon:

launchd% stop com.hiro.Daemon
launchd% remove com.hiro.Daemon

And behold, the launching stopped.