I am running MacOS Big Sur. I installed some apps downloaded online. I found out many apps were started automatically at startup.

By googling and examining my system, I figured out they were started from the file backgrounditems.btm which is located at ~/Library/Application Support/com.apple.backgroundtaskmanagementagent/. The file stores Login Items.

By running a python script downloaded online, I can see many Login Items registerd in the file backgrounditems.btm and they are NOT shown in System Preferences > Users > myuser > Login Iterms.

I tried the command osascript -e 'tell application "System Events" to delete login item "name"' to delete the hidden login iterm, but failed with error message "36:73: execution error: System Events got an error: Can’t get login item "myapp.app". (-1728)"

These hidden login iterms are also NOT shown when I use the command osascript -e 'tell application "System Events" to get the name of every login item'.

So my question is how to remove those unwanted login iterms to stop them autostart at my login. Command Line Way is prefered. I think some GUI apps such as ccleaner may do the job, but I don't want to install some GUI apps which may be autostarted themselves. Basically, I don't want to install an autostart iterm to remove autostart items.

Thanks a lot.


I figured out the file is in a binary plist format.

Then I tried two tools.

One is the default cml tool plutil. Another one is a thirdy party tool ProperTree. Both can convert and open the binary plist as XML plain plist. But even with a plain plist format, it's kinda hard to understand it. The important sections are still coded in base64 format in xml.

I can decode base64 with many tools, but I still feel it's kinda too much work for this purpose. Do anyone know any easier way to remove hidden login iterms from the file? Thanks.

  • Only LoginItems that were entered in the system settings for the respective user are written in here. /System/Volumes/Data/Users/$(whoami)/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm I am currently not aware of any way that LoginItems can be found. Because LoginItems can also be stored within an application package. They do not necessarily have to be stored in the system settings. Apps like EtreCheck check the /Applications directory for LoginItems. I don't think launchd is responsible for that – Darwin OS X Apr 9 at 7:54

I don't think it is necessary to remove them using the commands. You can do it from settings.

Open System Preferences and click on Users & Groups, then click the Login Items >tab. You’ll see a list of apps (and even files and folders) that open every time you log in. - Macworld

  • Thanks for your reply. But I think you didn't really read my question... To avoid wrong answer, in the third paragraph of the question, I have mentioned that they are NOT in the System Preferences > ... > Login Iterms. And that's why I always use the word "hidden" in the question. Cheers. – sgon00 Apr 9 at 5:33
  • Oh yeah you're right ha. I would use AppCleaner although I know you would rather do it from the command line. – Jessica Engel Apr 9 at 21:51

You must log in to answer this question.

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