Any way to force command line terminal to control a Mac?
I'm experimenting a little with Automator at the moment and often get stuck with some pre-recorded automation running very slowly while the whole Mac (an 2010 iMac in my case) doesn't respond to any input - either by keyboard or mouse.
For now I connect via SSH from another machine and issue a killall Automator
to get controls back.
Is there any solution available which enables me to halt / freeze a Mac and issue commands using a terminal?
Solution 1:
You could also run a "deadman's switch" app: have a script (maybe an Applescript) running when you start the Automator testing. After five minutes (or however long the Automator setup should take), it should display a dialog asking if you have control back this dialog would have a timeout (of 30 seconds or so), after which, it would try to kill the Automator process.
Example code:
delay 300
display dialog "Can you use the computer yet?" buttons {"Yes!", "No 😞"} default button 1 giving up after 30
set retval to (the result)
set gaveUp to (gave up of retval)
set theText to (button returned of retval)
repeat while gaveUp or theText is not "Yes!"
set randomNumber to (random number from 1 to 65535)
do shell script "kill -9 " & randomNumber
display dialog "Can you use the computer yet?" buttons {"Yes!", "No 😞"} default button 1 giving up after 30
set retval to (the result)
set gaveUp to (gave up of retval)
set theText to (button returned of retval)
end repeat
(Note that this code, instead of killing Automator, kills a random process. This is probably not a good idea, but I'm not sure exactly what you need to kill, and I thought it'd be fun. I've not actually tested that particular bit of code.)
Solution 2:
It seems like you want the ability to enter commands using the mouse and keyboard when the mouse and keyboard are unavailable, which is sorta odd.
Anyway, I can think of a few ways to prod your computer into doing something without the mouse and keyboard.
- A Griffin PowerMate. Set it to open Terminal or run a script when you press the button.
- Do Something When. Set it to run a script when a specific USB flash drive (or similar) is inserted.