Blog Archives

how to log out another user without logging in – updated

Screen Shot 2016-04-30 at 20.35.31

Posted: 10th May, 2013

If you have multiple accounts on your mac, you may sometimes wish to log out one or more of those accounts without actually having to sign in to them first via the fast user switching menu. There’s a couple of ways to do this. First, if the issue is just that you want to shutdown the computer, you can log out all users by entering an Admin user name and password when this dialogue automatically appears after hitting ‘Shutdown’ (it won’t appear if no other users are logged on):

log out window

However, there are times when you may just want a quick way to log out users without shutting down and without wasting time logging in to their accounts first. Be aware that in killing a user’s process without logging in to the account first, any data in that user’s account that is not already saved (or autosaved) will be lost. If you’re sure that’s not a problem, then follow this short procedure manually or use the AppleScript version that follows:

1. Open up Activity Monitor (/Applications/Utilities/Activity

2. Use the drop down menu in the Task bar to change the menu to ‘Other User Processes’  (note: you can use ‘All Processes’ in the menu if you wish, but that is less safe as it makes it possible to accidentally click on your own user process in step 4 below!).

3. In the filter bar, type loginwindow.

activity monitor

4. From the list of users that show up, for each one that you wish to log out:

  • click on its row in the Activity Monitor pane to highlight the process
  • press the ‘Quit Process’ icon in the Task bar above
  • from the resulting dialogue window, click ‘Force Quit’
  • supply an Admin password if requested.

Repeat for any further accounts that you wish to quit. (Tip: If you want to kill the ‘Guest User Account’, you’ll need to switch back to ‘All Processes’ and kill the loginwindow assigned to the ‘root’ user).

And that’s it. Your unwanted users are now logged out! 🙂

Update 30th April, 2016: If you get tired of doing this manually, you can log out all other real users at once with this AppleScript:

set thisUser to do shell script "whoami"
set usrList to paragraphs of (do shell script "ps caux -o args | grep loginwindow")

repeat with i from 1 to number of items in usrList
set this_item to item i of usrList
set thatUser to word 1 of this_item
if thisUser is not equal to thatUser then
set theProcessNum to word 2 of this_item
do shell script "kill -9 " & theProcessNum with administrator privileges
end if
end repeat

FastTasks – a utility for ten common terminal tasks


Update: I’ve since written a nice GUI version in AppleScript-ObjectiveC which you can download for free here»

If you find you only ever go into Terminal to perform a small number of tasks that can’t be done (easily or at all) in the OS X graphical user interface, this little utility could be for you. It allows you to run a number of common tasks such as

reveal and hide hidden folders
batch change the extension on multiple files
purge system free memory
flush the DNS cache
restore system preferences to defaults

without having to bother looking up the commands. You will, however, have to do a little Terminal ‘dirty work’ to initially get the utility up and running (it’s a shell script which you need to turn into an executable file), but step by step instructions are all provided. 😉

Here’s what you do:

1. Copy or download the entire script from here FastTasks code and paste it into a text editor (TextEdit or Tincta, my favourite, will do).

2. Save the file as plain text onto your desktop with the name ‘FastTasks’

3. Open and paste this command:

sudo chmod 755 ~/Desktop/FastTasks

and press ‘return’ on your keyboard. You’ll be asked for you Admin password which will be invisible when you type it. If you’re wondering what you’ve just done, you’ve just changed that plain text file into an executable program.

4. Paste the next line into

cp ~/Desktop/FastTasks /etc/bin/FastTasks

then press ‘return’ on your keyboard.

As a result of that last command, you can now use the script by typing ‘FastTasks’ in a Terminal window or by double-clicking ‘FastTasks’ in Finder or on the Desktop.

5. By the way, if the Terminal window remains open after FastTasks has completed, change the following settings in Terminal’s Preferences:

Preferences > Settings > Shell > When the shell exits…

and change the dropdown menu from ‘Don’t close the window’ to ‘Close if the shell exited cleanly’.

And that’s it. You can now run any of the tasks in the menu without having to know the commands! 🙂

Fast tips for using FastTasks

1. FastTasks is actually quickest to run by using Spotlight and Terminal.
If you have the Spotlight hotkey set up (usually cmd-space by default), simply open Spotlight, and type ‘Term’ and hit ‘return’ on the keyboard. At the Terminal prompt type ‘fasttasks’ and hit ‘return’.

2. Running it this way has another benefit. If you want to run FastTasks again after performing one task, just hit the ‘up’ arrow on the keyboard (hitting the ‘up’ arrow repeatedly will take you through previous commands entered at the Terminal prompt. Use the ‘down’ arrow to go forward), then ‘return’ when you see ‘fasttasks’ on the command line.

%d bloggers like this: