How to Log Out Another User Without Logging In On Mac OS X
For Macs who have multiple user accounts on a single computer, sometimes you may log in to multiple user accounts concurrently. This leaves the prior user account logged in while another user account session opens. There’s really nothing wrong with that, aside from reducing available resources, but sometimes you may wish to log out the other user account. The typical action to log out another user account in OS X is to switch to that account, log out from the Apple menu, and then returning to the desired account with another login. Kind of a hassle, right? Another option is to force the other user account to log out, without having to log back into it on the Mac.
Notice we said force the other account the log out, because how this actually works is to force quit the login process of the target user. Just like force quitting elsewhere, using this to forcibly log the target user out will cause any open application on their account to quit and exit without any saving or caching, which could result in unintended data loss since none of the open files, applications, or data would be saved. If you’re comfortable with that, continue to learn how to log out another user account without having to log into that user account first. If you’re not comfortable with that, just log back into that user account and log it out manually after saving files.
How to Force Log Out User Accounts on a Mac Without Logging Into Them
This will log out any target user account in Mac OS X without having to log back into it, it works the same in all versions of OS X.
- Launch Activity Monitor from Spotlight (Command+Spacebar) or through /Applications/Utilities/
- From the “View” menu choose “All Processes”
- Use the search box in the upper right corner of Activity Monitor to search for “loginwindow” – be sure to use exact syntax
- Select the ‘loginwindow’ process belonging to the user account you wish to log out
- Click the (X) Quit Process button and verify that you want to quit the loginwindow process for that user, acknowledging that it will log out the related user account
- Enter the admin password if requested, otherwise just choose “Force Quit” and continue, exit out of Activity Monitor when finished
By force quitting the target loginwindow process you are instantly logging out that target user and killing all of their applications and processes.
Because you’re targeting the user account name with this method, there is no visual cue like a profile picture to assist identification, so be sure you’re picking the proper user account to target for the forced log out procedure. As mentioned before, it will force quit all applications and processes on the target logged in user account, which could result in unintended data loss on that user account. This makes the task generally best reserved for advanced Mac users, though it’s clearly accessible to all user accounts, assuming you have an admin password to override whoever the other logged in user account is.
If you’re wondering, you can log out any user account this way by targeting it’s accompanying “loginwindow” process ID and quitting it, whether it’s any other user account on the Mac that is logged in, a guest user account, a hidden account, or even yourself. Of course if you kill the ‘loginwindow’ process of your own user account you are effectively logging yourself out in a forcible manner, which is rarely desirable.
If you find yourself doing this often, a better solution may be to set up automatic log out for the user accounts on a Mac, so that after a period of inactivity, they automatically log themselves out in the intended manner of OS X, preserving applications, files, and save states. That approach is basically like using the Apple menu > “Log Out Username” method, and is much softer than forcibly quitting a low level user process.
Know of another method of logging out another user account without having to directly log back into it, or without having to kill the associated users loginwindow ID? Let us know in the comments!
Great article, thank you so much for the effort.
One thing I haven’t been able to find any information online is whether it is possible to restrict the concurrent login session on macOS to just 1 similar to Windows desktop simultaneous RDP session (licensing restriction).
That way even though concurrent session can still be established but only one active login session is allowed at a time. Yes, the new user login will still disconnect the previous user session but at least the application status and data are all still preserved for the previous user. This may also help encourage users to simply jump onto another machine when finding the current one is already occupied just like the prompt on Windows: “Another user is signed in. If you continue, they’ll be disconnected. Do you want to sign in anyway?”
Random question, several years later. Is there a way to log a user in via the cli? And I don’t mean via an ssh session. I’m trying to work around the limit of 5 logged in users.
Hi
I had to use a possibly updated syntax on Mojave.
> users
> id jimmy
> sudo launchctl bootout user/502
Thanks for the tips! It helps me a lot!
Thanks for the tips very helpful
Hey, do anyone have someway to make an Automator action for this? Its could be easier for everyone want to do it quick.
Any user with admin privileges can log them out using launchctl if it is a post 10.9 system.
`launchctl gui/$(id ) bootout` will teardown the user’s temporary session and return the system to the login window.
You can see `launchctl help` for more information.
Remember that a user’s temporary domain (specified by `gui/501` or some other user id) is defined by that user’s id and the system will not map a username to the userid (but `id` will).
This is the most helpful article on logging out other Mac users without having to log into their user accounts, thank you so much. Just wanted to say thanks this is so useful! There is no other way to do this, so this is an amazing Mac article, thanks again!
Worked great! Thanks so much!
How to mack all account
I wish there was a way (short of a complete reboot) to have a log-out end ALL the processes that get created when you switch to another user. A simple log-on, log-off for a second user leaves no less than 18 separate processes running, including 4 copies of mdworker (don’t even get me started…). It’s not like they take up a ton of CPU cycles, but even sitting there in the background they are taking up VM (and undoubtably some real RAM). When you log out, it should log *everything* out.
Eric.
Did you ever find a solution for this?
I have the same issue with the kids accounts. Even when they “logout” there are a dozen or more process still left behind running in the background.
It would be great if there was a command to kill all processes belonging to a particular user?
This works fine but more often than not if you have access to the desktop of that machine then you could just select “Log Out [NAME]…”
If this is a tip for admins (which is seems like it is) then I might suggest going the command line route so long as ssh is enabled on the machine for at least the admin acct:
ps -ef | grep “loginwindow” | awk ‘{print $2}’ | head -n1
The output from that should be a number plug that number into the next command:
sudo kill -9 [ENTER NUMBER FROM PREVIOUS CMD]
(Hopefully it goes without saying but DO NOT use the brackets when entering the number)
It is possible to log in, run apps or processes, then and log out of additional user accounts without ever disturbing the active user. This is done from a remote machine on the network.
To set up this ability, open the Sharing Preference Pane. Turn on Remote Management, then click Computer Settings, and tick the box “VNC viewers may control screen with password.” Set a password.
From a remote Mac, launch a VNC viewer app such as JollysFastVNC Home found in the Apple App Store. Option double-click on the listing for the target Mac and then drop the menu to “Mac” as the log in method (not the default VNC.) This will give the option to log in using a user name and password. Log in to the desired account. Do what you need to do, and then using the Apple Menu of the virtual session, log out.
I do this during football season to run Elgato’s EyeTV app to capture a HD HomeRun stream (second game from what I am watching on cable) from a digital, over the air, antenna. This runs on my wife’s iMac under my account. She never notices I have logged in, am doing stuff (video is saved to a HD attached to a base station) in my account, or is disturbed by my activity. Very convenient.