8

I know there are Login Items under Users & Groups and /Library/LaunchAgents and /Library/LaunchDaemons under Library, System/Library and Users/FooUser/Library. And then there's right click on Dock icon -> Options -> Open at Login.

What other methods are there for apps to auto-start? The reason why I'm asking is because the Spotify App (downloaded from http://www.spotify.com) keeps starting up whenever I restart my Mac, even though I made sure there is no corresponding entry in any of the above mentioned places.

0

2 Answers 2

3

There are two places for LaunchAgents to be called from:

  • /Library/LaunchAgents - this launches a process at login for every user
  • ~/Library/LaunchAgents - this launches a process at login for a specific user.

The Spotify startup plist is found in the latter; the com.spotify.webhelper.plist allows you to open Spotify via the web.

Issue the command launchctl list | grep -i spotify and you should find (up to) two plists that are loaded:

$ launchctl list | grep spotify
-       0   com.spotify.client.startuphelper
9087    0   com.spotify.webhelper

To unload them, you can uncheck the option in Advanced Settings (Command,)

enter image description here

Or...

You can issue the command:

$ launchctl unload com.spotify.client.startuphelper.plist
5
  • Thank you for your reply. I did have com.spotify.webhelper.plist under ~/Library/LaunchAgents, but what I meant to say above, I removed these entries. However, it keeps reappearing whenever I reboot. "$ launchctl list | grep spotify" shows "com.spotify.client.startuphelper", but "launchctl unload com.spotify.client.startuphelper" returns "No such file or directory". Disabling it within the app as you described works, but I would prefer not depending upon the goodwill of applications to include such options.
    – makrom
    May 12, 2018 at 23:12
  • You have to use the extension .plist. (I fixed the mistake). I just tested and it removes it and doesn't load. If it can't find the file, you can remove it from launchd with the command launchctl remove com.spotify.client.startuphelper.plist
    – Allan
    May 12, 2018 at 23:25
  • Their startup behavior is actually pretty interesting. I have no entries in launchd, no plists, even in /Library but it's starting up anyway. I've created a test user, launched Spotify once without even logging in and it kept autostarting from then on. Even clearing the entire home folder of the user didn't stop it from launching. Wonder how they do it. Nov 21, 2018 at 9:46
  • 1
    The reason we should know is because malicious apps could use the same method to stay undetected. We've come to rely on cleaning LaunchAgents and LaunchDaemons and "Open at Login" but clearly there's some other obscure method involved. Nov 21, 2018 at 9:53
  • That doesn't work as of now, unfortunately :-(
    – Skeeve
    Nov 15, 2020 at 9:54
3

There are several ways that programs can automatically start in macOS:

First check "Login Items" which are found in System Preferences after clicking the "Users & Groups" icons. I understand that you have already checked here and did not find Spotify.

Another possibility is that Spotify have been set to open at login from the dock. You can right-click the Spotify icon in the dock, and then in the Options menu make sure that "Open at login" is not enabled.

Similarly if you have left Spotify running when you power down the Mac then by default the app and open windows will be opened again after rebooting. You can avoid this by ensuring that you close Spotify before logging out or rebooting, or change the setting in general by clicking the "General" icon System Preferences and making sure there's a checkmark in "Close windows when quitting an app".

A third possibility is that it is possible to create configuration files for launchd that will automatically start programs at boot or login. You'll find these configurations files in:

~/Library/LaunchAgents/
/Library/LaunchAgents/
/Library/LaunchDaemons/

Note that the ~ characters means your user's home folder.

A final possiblity is that applications in macOS can come with a "shared helper application". Essentially this application would provide some background service to one or more actual applications from that developer. Some use that helper application to later launch their actual application.

The helper application is located within the application's bundle in the Contents/Library/LoginItems folder. For Spotify that is usually in the following location:

/Applications/Spotify.app/Contents/Library/LoginItems/StartUpHelper.app

You can prevent that from autostarting Spotify by closing the helper app, or making sure that it cannot start (for example by removing the executable bit on the actual executable: /Applications/Spotify.app/Contents/Library/LoginItems/StartUpHelper.app/Contents/MacOS/StartUpHelper)

You must log in to answer this question.

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