Search code examples
macospliststartupautorun

MacOS disable auto-run of applications upon log in?


Is it possible to prevent MacOS application auto-run at login even if it can't be found in the System Preferences under: Users & Groups → Login Items?


Solution

  • Disable autostart using Microsoft OneDrive Updater as an example

    1. Check applications that you have:

    ls -l /Library/LaunchAgents/*.plist
    

    output:

    -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. Open OneDrive Updater:

    sudo nano /Library/LaunchAgents/com.microsoft.OneDriveStandaloneUpdater.plist
    

    output:

    <?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. Change RunAtLoad to false:

    <key>RunAtLoad</key>
    <true/>
    
    <key>RunAtLoad</key>
    <false/>
    

    4. Save changes

    5. ...

    6. Profit

    *Checked at Catalina and Big Sur versions