There is a way to view these 'hidden' items, but it requires a few steps.
First, some background...
- As I understand, there are several ways an app or service can be 'automatically' launched:
- LaunchDaemons (system-wide only)
- LaunchAgents (system-wide or per-user)
- StartupItems (system-wide or per-user)
- "Shared file lists" (this may be part of one of the above)
- By any running script or application
- Using the legacy 'cron' system
- Using the Service Management framework
- This may be the 'preferred' method for user-installed apps, dating back to around the time 'Sandboxed' apps were introduced; an app installer isn't needed and its seems fairly 'auto-healing'.
- (perhaps others I haven't thought of...)
- Version 1.1.35 of Spotify.app contains the following files or packages that may be of interest:
- /Applications/Spotify.app/Contents/Library/LoginItems/StartUpHelper.app
details
CFBundleIdentifier: com.spotify.client.startuphelper
CFBundleName: StartUpHelper
LSBackgroundOnly: True
- This is the application that Spotify.app registers with the XPC services via the Service Management framework
- /Applications/Spotify.app/Contents/MacOS/sp_relauncher
- (this may have to do with software updates)
Data collection
Open a terminal window and copy/run the following commands, as desired:
- Notes:
- These are optimized for the 'bash' shell, so run the following before any of the others:
bash \
# Load the 'bash' command shell, since 'zsh' is now the default on new installations
- Replace 'less' with 'cat' in the following commands, as desired.
- If you have set up more than one user account on your computer, get your numeric userID (usually 3 digits, starting with '50'), either
- from the 'Advanced Settings' of the User & Groups part of the control panel ("System Preferences")
- or by running the following command:
echo "show State:/Users/ConsoleUser" | scutil | awk '/kCGSSessionUserIDKey :/ { print $3 }' \
# Reference: https://macblog.org/uid/
- View the XPC services loaded by apps via the Service Management framework:
- View enabled items for user #501 (press 'q' to return to the command prompt):
less /var/db/com.apple.xpc.launchd/loginitems.501.plist \
# Enabled items for user #501
- View disabled items for user #501 (press 'q' to return to the command prompt):
less /var/db/com.apple.xpc.launchd/disabled.501.plist \
# Disabled items for user #501
- View system-wide disabled items (press 'q' to return to the command prompt):
less /var/db/com.apple.xpc.launchd/disabled.plist \
# System-wide disabled items
- Notes:
- Replace "501" in each of the above commands with the desired numeric user ID
- If you receive an error when running any of the above, try it again preceded with "sudo " to run that command with elevated privileges (the first time this is done in a particular window, you will be asked to enter your password)
- I don't know what will happen if someone were to manually edit these files, but it is likely they would be re-generated at some point.
- Show all applications in the /Applications folder that contain an embedded LoginItem:
find /Applications/*/Contents/Library/LoginItems/*.app -maxdepth 0
- Show all LaunchAgents, LaunchDaemons, and StartupItems:
find \
~/Library/LaunchAgents \
/Library/LaunchAgents \
/Library/LaunchDaemons \
/Library/StartupItems \
/System/Library/LaunchAgents \
/System/Library/LaunchAgentsIgnored \
/System/Library/LaunchDaemons \
/System/Library/StartupItems \
-print | less \
# Show all files in the above directories
- (Press 'q' to return to the command prompt, press <SPACE> for the next page, and use the up/down arrows to scroll)
Final thoughts
- There doesn't seem to be any built-in (at least not as of macOS 10.15) command-line tool to view (let alone control) Service Management framework login items (aka 'com.apple.xpc.smloginitem') used by applications such as Spotify.app.
- Simply moving Spotify.app out of the /Applications folder probably won't do anything these days; moving it off of the boot partition might. One could also store it in a disk image that they only mount when they wish to run it.
References