My wife use separate accounts and quick user switching on a MBP running 10.6. Sometimes I want to log her out to free up some RAM, but I'd like to avoid logging in as her, logging out, then logging back in as me.

I have seen a terminal solution... is there a better way? Thanks!

  • 5
    You need to better define "is there a better way". For me, not much (computer-wise) is better than a terminal. If you want an app, just wrap the terminal command in an automator or applescript app.
    – user588
    Oct 27, 2010 at 0:47
  • 2
    @mankoff, good point! But this isn't an Arch Linux forum, so let's assume I want a GUI/built-in solution :). But, you're right, I can just write a shell script. Oct 27, 2010 at 2:12
  • 2
    Here is the link to the script solution (I saw it before posting, but it's from 2005, so I assumed that by now this simple feature must have been incorporated into the GUI). forums.macrumors.com/showthread.php?t=118545 Oct 27, 2010 at 2:13
  • there is no built-in gui solution that i know of... Oct 27, 2010 at 3:29
  • OK, thanks, All! When I write a good script, I'll post it back here. Oct 27, 2010 at 3:51

5 Answers 5


Using the Terminal, you can kill her loginwindow process and any programs she has open will be closed... but this will cause her to lose any unsaved work she has! In fact, this is the very reason you need to log in as her to log out: When you log in as her, all her programs again have access to the GUI, so they can prompt you to confirm closure, save changes or take other action before logging out.

If you're sure that she only has things like a web browser, iTunes, etc open, not Pages, Word, Photoshop, or anything else with documents, then you could try from the terminal:

kill `ps awwwwux | grep her_short_username | grep loginwindow | grep -v grep | awk "{ print \$2 }"`

On OSX 10.10.4: (slight edit from last comment):

export pn=`ps awwwwux | awk '/her_short_username/ && /loginwind[o]w/ { print $2 }'`
sudo kill -9 $pn
  • 1
    Agree with the warning that if you don't log in to see what she's doing, then you don't know what you might cost her by logging her out.
    – Michael H.
    Nov 5, 2010 at 17:49
  • Yeah, you're right. Most of the time it's web-browsing... But one time it won't be! Thanks! Nov 6, 2010 at 0:58
  • 4
    If you force-terminate her loginwindow through Activity Monitor.app you could conveniently glance at the same time what other processes she has left open. Jul 29, 2011 at 11:54
  • 1
    If you end up running Awk anyway, the multiple grep commands can easily be avoided. ps awwwwux | awk '/her_short_username/ && /loginwind[o]w/ { print $2 } | xargs kill and see also iki.fi/era/unix/award.html#grep
    – tripleee
    Jul 8, 2015 at 18:19
  • 1
    just fix a typo in your updated command, reads sudu should read sudo.
    – hoss
    Sep 26, 2015 at 14:10

You can use the Activity Monitor to log another user out by killing their login process:

  1. Run Activity Monitor
  2. In the filter at the top-right, type loginwindow
  3. Click the row with the user's name in the User column
  4. Click Quit Process, then Force Quit, and type your password.

This is just a nicer(?) GUI version of Josh's answer.

Before step 2, you can review the other user's running processes to see if they are running any apps that might lose data on logout.

  • 1
    I tried this and still see the other user's processes running in Activity Monitor. True, the account appear logged out in the user switching menu, but it doesn't seem to be truly the same thing as logging out.
    – Gorb
    Jul 15, 2018 at 16:09
  • Same. Maybe this doesn't work in a more current OS than Bennet was using
    – jcollum
    Apr 1, 2020 at 23:23
  • As of MacOS Mojave it still works. I notice that even when you actually log out the other user normally, there are still over 20 processes running under that user. The same thing happens if you force-quit loginwindow. Mar 16, 2021 at 2:18

This command is simpler than the one suggested and it will have the desire result to kill all the user's processes (I had to run it twice)

sudo pkill -9 -u user

If you just want to kill the loginwindow process for that user you can do the following:

sudo pkill -9 -u user loginwindow

  • 1
    Seems to me this is a clearly better and more idiomatic answer (from a unix sysadmin standpoint) than the others. Jul 26, 2018 at 1:10

I think the simplest way of doing it is

sudo killall -9 -u *wifes_name*
  • Using MacOS Mojave, this is the only solution after trying many which not only killed the LoginWindow process, but many other processes owned by that user. Killing the LoginWindow process for that user alone didn't kill many other processes started by that user. This solution (replacing with my wife's name) got rid of every single process started by her login. Akin to rebooting the machine and just logging in yourself.
    – i-CONICA
    Mar 16, 2019 at 10:01

In my opinion, the possible loss of data far outweights the possible gain in RAM.

Moreover, it has been a long time since Unix was able to swap memory to disk when a process was idle.

  • 2
    One problem is that when a user is switched out, their processes may not be idle. They may be chewing up CPU and memory. Games seem particularly bad in this respect. Mar 12, 2015 at 20:59
  • 2
    Question mentions the wife, but there is actually an even better case - when you have a child that has exceed their time limit for the day and only plays games and does other things that don't need saving. Now not only do you have to log in as the kid but add time just to log them out.
    – Michael
    Jul 25, 2015 at 16:28
  • @Michael That is exactly my use case. :) Aug 24, 2015 at 23:40

You must log in to answer this question.

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