I was running some beta apps that try and insert themselves as log in items and now need to clean up the mess they left.
Now I have many unknown items in there which are not removable. I was able to retrieve the 20 items only by running this code:
let loginItems: NSArray = LSSharedFileListCopySnapshot(loginItemsRef, nil).takeRetainedValue() as NSArray
- However the LSSharedFileListItemRemove method is deprecated and I can't remove them programmatically on High Sierra or later.
- Furthermore, now when I click on hide in any of unknown login items, I get another unknown entry below duplicated. I had only one, but when clicked many times(not believing that such a bug can be in OS X) on hide/unhide I got 20 of them. This means attempts to clean one item grows more from the UI.
Checked with no luck:
/Library/LaunchDaemons/ /Library/LaunchAgents/ ~/Library/LaunchAgents /Library/StartupItems ...loginitems.plist ...loginwindow.plist
Is there a way to nuke all the items in this list to get a clean start?