Mac OS X command to log out

Every once in a while, not a whole lot, but more than mac finantics are willing to admit: My mac goes wack, and for whatever reason my only hope is to either log out, or force the machine down (hold down power button for 10 seconds). Well, as I enjoy a long uptime just as much as the next guy, I would much prefer to log out rather than shut down. If my mac is really not responding, here’s what sometimes will work:

1. SSH into the mac from another machine. Use a tool like putty to login to your mac from another machine.

2. Get the PID of the “loginwindow” command.

ps -Ajc | grep loginwindow

3. Kill the loginwinow PID. The first column of the output line of the above command will be the PID, you want to kill the process.

sudo kill PID

For example:

russds:~ russell$ ps -Ajc | grep loginwindow
russell 38 1 38 729f750 0 Ss ?? 0:24.37 loginwindow

Then logout with:

russds:~ russell$ sudo kill 38

Rate This Article:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Comment

You must be logged in to post a comment.