How to log out a fast switched user
Power Manager includes a trick that allows you to nicely log out a fast switched user.
Power Manager includes a trick that allows you to nicely log out a fast switched user.
With
Power Manager installed, every user on your Mac has a pmassistant
process running. To log out a specific user, send their pmassistant
process a USR1
signal (SIGUSR1
).
Applications > Utilities > Terminal
Listing pmassisants
To get a list of pmassisant
processes running on your Mac, type the following into the Terminal:
ps auxc | grep pmassistant
The response will look something like the following:
mb 467 0.0 0.5 124968 5152 ?? S 1:08pm 0:00.28 pmassistant
gcm 164 0.0 0.4 246612 3992 ?? S 9:47am 0:00.29 pmassistant
Send a SIGUSR1
signal to the pmassistant
process
To send a SIGUSR1
to a pmassistant
, and thus log that user out, type the following into the Terminal:
sudo kill -USR1 467
The 467
must be replaced with the process id of the user’s pmassistant
. Sending a SIGUSR1
to non-pmassistant processes will result in unpredictable behaviour.
After entering your password, to ensure only those with administrator rights can log out users, pmassistant
will nicely log out the user.
Why is this an improvement?
Using pmassistant
to log out a user is better than Mac OS X’s default behaviour when forcing fast switched users to log out.
Mac OS X and Darwin’s automatic shut down methods are brutal. They do not respect the Mac architecture. These methods come from a unix world and thus expect particularly resilient behaviour from running applications. Sadly this expectation does not bode well for many of today’s Mac applications.
Power Manager uses a friendly method of logging out users’ processes. It still ends with a guaranteed log out, but it gives running applications a chance to autosave changes and release resources or hardware appropriately.