Spotify automatic startup mystery Trying to get rid of Spotify's startup at login time I found an interesting behavior: while its plists are not present in any of the known locations such as Library/LaunchAgents and Library/LaunchDaemons and it's also not set to Open at Login either in the Dock or during logout, it still manages to start up somehow.

I've created a new test user, started the app just once, was greeted with a login prompt, closed the app and it decided it would start ever since. I've tried deleting the entire contents of the user's home folder in the Terminal while running as another user (rm -rf /users/testuser/*), but Spotify would start anyway.

Wonder how they do that? It's pretty easy to check by downloading and running the app, there's no need to even create an account.

The point of the question is to understand the mechanism rather than actually stop it from opening (there's a switch in the app).
A lot of functionality, like login items, extensions/kexts, LaunchAgents or other Helpers can be packed into the application bundle these days.

If you look closely at the content of the Spotify.app, by right- or control clicking it and selecting "Show Package Contents", you'll find a "Library" folder enclosed in the Content's folder.  Within it there is a LoginItems folder, containing the login item.
    /Applications/Spotify.app/Contents/Library/LoginItems/StartUpHelper.app/Contents/MacOS/StartUpHelper

This "StartUpHelper" will launch Spotify at login.  This seems to be the application's default behaviour.

You wrote:


  Otherwise it would start for every new user added to the system.


I certainly have seen Spotify auto-launch on a user created after it had been installed, logging out of the user that created the new account and setting up the new user account from the login screen (alternatively two restarts were needed for Spotify to launch at login in the new user account). Only when Spotify got installed after the user was created, did it not launch at login.

A test in an attempt to explain, why some users will not see the auto-launch of Spotify at login:

I created and set up a new user before Spotify was installed on a different user account and, after Spotify was installed (again in a different user account), tried several logouts/logins and restarts to make sure it didn’t auto-launch at login for this new user. I also noted the user’s DARWIN USER DIRECTORY running the following command...
getconf DARWIN_USER_DIR

I also had a user for whom Spotify auto-launched at login every single time.  Again I noted the user’s DARWIN USER DIRECTORY.
Logged into this last mentioned user I quit Spotify and deleted...com.apple.LaunchServices-231-v2.csstore ...from the Darwin User Directory. Then I copied the same file from the other user’s Darwin User Directory (for whom Spotify didn’t auto-launch at login) over to this user’s directory (in Finder, to make sure the file’s owner would also change).

Then I logged out and rebooted several times into the user, for whom Spotify did auto-launch, but the behaviour stopped and Spotify refrained from launching.

PS. For further in depth information on login items within an application bundle, I’d suggest signing up for a free Developer account and getting acquainted with (some of) the documentation on application design (you don't have to sign up though, just to read the documentation).