12

I've found a couple apps that seem to be able to launch themselves on startup, despite that they don't appear in the usual places...

- Login Items (in the Users preference pane)
- /Library/LaunchAgents
- /Library/LaunchDaemons
- /Library/StartupItems
- /System/Library/LaunchAgents
- /System/Library/LaunchDaemons
- /System/Library/StartupItems
- ~/Library/LaunchAgents
- ~/Library/LaunchDaemons
- ~/Library/StartupItems

At least some of these apps (e.g. Day One and Pauses – both from the Mac App Store) seem to be launching an item from their own internal LoginItems folders:

/Applications/Day One.app/Contents/Library/LoginItems/Day One Reminders.app
/Applications/Pauses.app/Contents/Library/LoginItems/PausesLauncher.app

As good citizens, both apps allow you to disable the launch-on-login behavior, but it's disconcerting that this behavior doesn't seem to be controllable from a system-wide preference, and I'd like a way to systematically identify/control these login items. So, the (two-part) question is:

  • What is actually controlling whether/how these app-specific launch items are being activated, and
  • How can I get an inventory of all these login items?

[edited for clarity 2013-03-20 11:22 PT]

6
  • (Note that this is not a dupe of "Disabling startup items that run despite being unchecked on the “login items” list") ;)
    – Dan
    Commented Mar 20, 2013 at 17:48
  • Why do you think it's not a duplicate (helps to prevent getting the same answers again)? And I assume you're experiencing this with specific applications, could you list them in your question please?
    – nohillside
    Commented Mar 20, 2013 at 17:51
  • And I think you are mistaking the Day One thing. The thing you listed above is just the Reminder app (menulet) which does get started if launch-at-login is checked. It's not a sandboxed LaunchAgents/Daemons folder.
    – nohillside
    Commented Mar 20, 2013 at 17:54
  • Thanks for the clarification. I may be mistaken about the diagnosis, but that's where I saw activity when watching the "disable" action with fs_usage, so I assumed that was what's going on.
    – Dan
    Commented Mar 20, 2013 at 17:57
  • And, not a dupe because the other question was answered with the standard list of loginitems that I listed at the start of the question. The applications I'm seeing this happen with (including Day One) don't appear in my Login Items or those directories...
    – Dan
    Commented Mar 20, 2013 at 17:58

3 Answers 3

9

Day One seems to store the login item in /var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist:

$ /usr/libexec/PlistBuddy -c 'Print _com.apple.SMLoginItemBookmarks:com.dayoneapp.dayone-agent' /var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist
book 0(UserslaurTorrents
                        Day One.apContentsLibrary
LoginItemsDay One Reminders.app $4HXh?kld ????$A????H???A?1M?$5DF7A03E-A7FB-3E80-B61D-F10CD8BF7B5D?/?0c75ae904b0f99cb3a794e7360629c822a0f4a14;00000000;0000000000000020;com.apple.app-sandbox.read-write;00000001;01000002;0000000000641712;/users/lauri/torrents/day one.app/contents/library/loginitems/day one reminders.app??????D|@l 0 ? ? ? ?  0 <???????D

Changing this to true in that same file disabled it:

<key>com.dayoneapp.dayone-agent</key>
<dict>
    <key>Disabled</key>
    <false/>
</dict>
3
  • 1
    Nice -- looks like that's the answer. I'm still baffled why this isn't surfaced anywhere obvious: it's not in the Login Items preference pane (granted, there would need to be a new section for all users)... not in any of the launch folders... not even in Lingon. Out of curiosity, how did you know where to look?
    – Dan
    Commented Mar 21, 2013 at 23:50
  • I ran fseventer when I opened Day One for the first time.
    – Lri
    Commented Mar 22, 2013 at 13:21
  • Thanks for sharing your investigative results! I sometimes also use fseventer for FS monitoring applications.
    – porg
    Commented Feb 3, 2016 at 19:21
2

(This is not about the user visible Login Items under the Users & Groups Systems Preferences)

The Contents/Library/LoginItems/ buried in the application bundle is what appears to be the implementation of Apple's approach to sandboxed apps.

The tip from @user495470 about the storage of the login item reference in /var/db/launchd.db/ seems to be now defunct in macOS 10.12

Apple's direction appears to be heading into the app-self-contained approach where the LaunchDaemons, LaunchAgents, and StartupItems may be off-limits in the future as Mac apps may be required to be sandboxed at some point (personal conjecture, not fact). On the other hand CFPreferences API and sending AppleEvents to launch are deprecated...

Ref:

While in the past it was easy to look in the aforementioned folders for startup launch information (per Dan), this new sandboxed model, while theoretically safer operationally, hides the an app's (or Trojan's?) startup capability from all normal users and most superusers who know to look in the system directories. Finding these hidden Login Items now has become a PITA (pain in the app) with either grep'ing your way through the Applications folder or manually open app bundles looking in /Contents/Library/ for a "LoginItems" folder and it's contents. For the user level solution, I did find a tool that lists the app bundle embedded Login Items called CleanMyMac (can deactivate or activate them. Be careful, only get this app from the company. There are cracked versions available that actually carry a virus in a way very similar to how Login Items now works (irony)..) CleanMyMac showing Login Items picker

And notice how these items, enabled or disabled, are not part of the user visible "Login Items" under the "Users & Groups" System Preferences:

If you are like me and you are working this at a code level, a consolidated guide to implementation is here (by Tim Schroeder 2013): The Launch at Login Sandbox Project

2

/var/db/launchd.db/com.apple.launchd.peruser.$UID/overrides.plist no longer exists in recent macOS versions (at least since macOS 12); instead, the login overrides are now stored in /var/db/com.apple.xpc.launchd/disabled.$UID.plist.

To get a full list, run launchctl list, which prints out every service on your machine. For a login item in an app's internal Contents/Library/LoginItems directory, the service identifier should be the login item's bundle identifier (CFBundleIdentifier), which you can get from the item's Contents/Info.plist. You can confirm that this identifier shows up in launchctl list.

To disable, run launchctl disable gui/$UID/<bundle id>. For example, to disable the WireGuard run-at-startup (located at /Applications/WireGuard.app/Contents/Library/LoginItems/WireGuardLoginItemHelper.app), which as of version 1.0.15 did not have a preference to disable autostart, you would run

launchctl disable gui/$UID/com.wireguard.macos.login-item-helper

(In a terminal, you can type echo $UID to obtain your current user ID).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .