Any way to use ssh to recover a Mac from spinning beach ball of death On Linux, I can get to a ssh or Ctrl-Alt-F1 console and type in a command to restart the window manager.

Is there any equivalent for Mac Mountain Lion?

I tried ssh'ing to a frozen Mac, and I could kill individual processes, but I could not unstuck the machine. Running the command sudo reboot killed my ssh ability, but did not restart the machine.
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.