Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question
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 '10 at 0:47
@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. – Richard Herron Oct 27 '10 at 2:12
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). – Richard Herron Oct 27 '10 at 2:13
there is no built-in gui solution that i know of... – Robert S Ciaccio Oct 27 '10 at 3:29
OK, thanks, All! When I write a good script, I'll post it back here. – Richard Herron Oct 27 '10 at 3:51
up vote 19 down vote accepted

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
share|improve this answer
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. – khedron Nov 5 '10 at 17:49
Yeah, you're right. Most of the time it's web-browsing... But one time it won't be! Thanks! – Richard Herron Nov 6 '10 at 0:58
If you force-terminate her loginwindow through Activity you could conveniently glance at the same time what other processes she has left open. – koiyu Jul 29 '11 at 11:54
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 – tripleee Jul 8 '15 at 18:19
just fix a typo in your updated command, reads sudu should read sudo. – hoss Sep 26 '15 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.

share|improve this answer

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.

share|improve this answer
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. – Bennett McElwee Mar 12 '15 at 20:59
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 '15 at 16:28
@Michael That is exactly my use case. :) – Bennett McElwee Aug 24 '15 at 23:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.