Currently I am trying to setup up some automation on my Mac using launchagent plist files and various other mechanisms provided by macOS.
How I programmatically create a plist file:
import plistlib
data = {
'Label': 'some label',
'ProgramArguments': [path/to/shell_script],
'RunAtLoad': True,
'KeepAlive': False
}
with open(my_plist_file_path, 'wb') as plist_file:
plistlib.dump(data, plist_file)
So this little snippet successfully creates a plist file in ~/Library/LaunchAgents/ where all other user specific plist files are located... BUT:
Every time I do so, I get the mac os system notification saying:
Background Items Added: ...
And my question is simply: why?
How can i programmatically create a plist without triggering this notification?
Version: Mac OS Ventura 13.5
In ~/Library/LaunchAgents/ I can see many other plist files which have been created by e.g. Google Chrome / Homebrew but these plist files never triggered the notification described above.
https://discussions.apple.com/thread/254476743
You can reset background task management database, to get around this.
https://support.apple.com/en-gb/guide/deployment/depdca572563/web
You can call directly from python code :