Why is launchd saying “service already loaded” but “launchctl list” doesn’t show the service

launchd

I created the configuration files in ~/Library/LaunchAgents

When I attempted to load the plist, I got the message that the service was already loaded.

launchctl load ~/LaunchAgents/hosts_Blocksites_AM.plist  
/Users/bryan/LaunchAgents/hosts_Blocksites_AM.plist: service already loaded  

When I attempted to find the Launchd agent nothing was returned.

$ sudo launchctl list | grep hosts_Blocksites_AM.plist

EDIT: fixed typo where I had:
launchctl load ~/LaunchAgents/hosts_unBlocksites_AM.plist

Best Answer

It's possibly because you grep'ed for a different file than you tried to load (hosts_unBlocksites_AM.plist vs. hosts_Blocksites_AM.plist), but also note that root has its own list of launch agents and when you run sudo launchctl list you will see root's list, which is different from launchctl list which will show yours.

So this should work (depending on what you're trying to do in your launch agent):

launchctl list | grep Blocksites
launchctl load ~/LaunchAgents/hosts_unBlocksites_AM.plist

If needed, run both as sudo (not just one of them).

Related Question