How to delete hidden login iterms from backgrounditems.btm? CML way is prefered 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 &gt; Users &gt; myuser &gt; Login Iterms.
I tried the command osascript -e 'tell application &quot;System Events&quot; to delete login item &quot;name&quot;' to delete the hidden login iterm, but failed with error message &quot;36:73: execution error: System Events got an error: Can’t get login item &quot;myapp.app&quot;. (-1728)&quot;
These hidden login iterms are also NOT shown when I use the command osascript -e 'tell application &quot;System Events&quot; 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.
Update
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.
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 &amp; Groups, then click the Login Items &gt;tab. You’ll see a list of apps (and even files and folders) that open every time you log in. - Macworld