Any way to use ssh to recover a Mac from spinning beach ball of death

Solution 1:

To reply to your question: no there isn't such a function accessible at the window manager level. It is a good suggestion to forward to Apple MacOS X feedback

Is your Mac still up?

Try:

ping IP_of_my_mac

Can you access it with ssh?

Can you provide us a copy of the output of a:

top -o cpu

and:

tail -20 /var/log/system.log

If the problem appears once more, could you try to kill the loginwindow like this: connect on your mad Mac with ssh

/usr/bin/sudo /bin/kill `ps ax | grep '[/]loginwindow' | awk '{print $1}'`

This uggly command:

ps ax | grep '[/]loginwindow' | awk '{print $1}'

is a trick to give you the process ID of the loginwindow process with no risk to kill the wrong guy. I'm not sure this will be enough to force a total free and reset of the GPU. Please tell me if this doesn't work so I could remove a useless and dangerous workaround.

Solution 2:

I use this in a shell script called restart-graphical.sh

#!/bin/sh

sudo killall -HUP WindowServer

exit 0

This will NOT give you a chance to save anything.

Note that I have run into a situation where nothing will help except the power plug. This is often when a USB or FireWire device has caused an incurable hang.