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.
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.