How to Manage macOS Login Items Using the sfltool Command Line Utility

When troubleshooting a slow Mac, system administrators frequently need to review and disable “Login Items”—the applications that launch automatically when a user logs in. While users can manage these through System Settings > General > Login Items, IT professionals managing fleets of Macs via SSH or MDM scripts require a command-line method. The modern tool for this job in macOS is sfltool.

Understanding the Shared File List (sfl)

In the past, macOS managed login items via property lists or the osascript command. Modern macOS versions manage them using the Shared File List (sfl) framework. The sfltool utility allows administrators to interact with these lists directly from the Terminal.

How to View Current Login Items

To see exactly what is configured to launch when the current user logs in, open the Terminal and run the “dump” command against the login items list identifier:

sfltool dump com.apple.LSSharedFileList.SessionLoginItems

The output will be verbose, displaying internal IDs, URLs, and metadata for every item. Look for the lines starting with Name: and URL: to identify the specific applications.

How to Add a Login Item via Terminal

If you want to ensure a specific application (like a corporate VPN client or a management agent) launches automatically, you can add it to the user’s login items using the “add-item” command.

For example, to add Google Chrome to the login items, use the following syntax:

sfltool add-item com.apple.LSSharedFileList.SessionLoginItems file:///Applications/Google%20Chrome.app

Note: The path must be formatted as a file URL (file:///) and any spaces must be URL-encoded as %20.

How to Remove All Login Items

Currently, Apple has restricted the ability for sfltool to remove individual login items programmatically for security reasons (preventing malicious scripts from disabling security software). However, for extreme troubleshooting, you can clear the entire list at once.

To completely wipe all user-defined login items, use the “clear” command:

sfltool clear com.apple.LSSharedFileList.SessionLoginItems

This command takes effect immediately. The next time the user logs in, only core system daemons will launch, providing a clean baseline for performance testing.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.