4

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.

I'm speculating something went wrong while trying to follow this and this solutions in order to add 'launch at login' functionality to my app.

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

enter image description here

Is there a way to nuke all the items in this list to get a clean start?

1

This appears to be a bug in OS X High Sierra (it may affect other versions too) and has been bugging the crap out of me for the past few weeks. I finally managed to find a solution, thanks to a post I made on this Github issue. Try this solution.

Basically you will want to remove the file $HOME/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm. Then reboot.

Note that that this will remove all Login Items you currently have set up so be sure and make a note of all of the apps, volumes, etc. you currently have set to auto-launch at startup, because you will have to re-set them up. But this definitely got rid of all the "Unknown" items for me.

The other alternative is to set up a new user folder and migrate in your other files, but having a backup and erase install / migrating in from a backup is a great solution as well.

  • Thanks. It might work but currently I have no such issue to test your solution. If you're sure of this solution, I can choose it as accepted – Vito Valov Oct 24 '17 at 13:53
  • this does at least get you started – David Van De Meer Nov 9 '17 at 6:47
  • 1
    This path doesn't exist for me. There is no com.apple.backgroundtaskmanagementagent folder. – Gaurav Nov 4 '18 at 23:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .