问题描述
即使在 System preferences → Users & Groups → Login Items
中找不到 MacOS 应用程序,如何防止它在登录时自动运行?
解决方法
以 Microsoft OneDrive Updater 为例禁用自动启动
1.检查您拥有的应用程序:
ls -l /Library/LaunchAgents/*.plist
输出:
-rw-r--r-- 1 root wheel 523 Feb 17 14:30 /Library/LaunchAgents/com.microsoft.OneDriveStandaloneUpdater.plist
-rw-r--r-- 1 root wheel 377 Feb 17 14:30 /Library/LaunchAgents/com.microsoft.update.agent.plist
2.打开 OneDrive 更新程序:
sudo nano /Library/LaunchAgents/com.microsoft.OneDriveStandaloneUpdater.plist
输出:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.microsoft.OneDriveStandaloneUpdater</string>
<key>Program</key>
<string>/Applications/OneDrive.app/Contents/StandaloneUpdater.app/Contents/MacOS/OneDriveStandaloneUpdater</string>
<key>ProgramArguments</key>
<array/>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>86400</integer>
</dict>
</plist>
3.将 RunAtLoad
更改为 false
:
<key>RunAtLoad</key>
<true/>
<key>RunAtLoad</key>
<false/>
4.保存更改
5. ...
6.利润