Search code examples
macosmacos-sierrasystem-administration

What is the best way to log out another user from their session on macOS?


In other words:

  1. Log on as Bert (who is an administrator)
  2. Using fast user switching, log on as Ernie (Bert remains logged on)
  3. Switch back to Bert
  4. Bert logs Ernie off

What is the best way to achieve step 4?


Solution

  • sudo launchctl bootout user/$(id -u <username>)

    Replace <username> with the target user's user name.