MacOS – How to run Excel on headless Mac

applescriptmacosms officessh

I'd like to run applescript to control Excel on a headless Mac.

I want to do it from the command line via ssh, and I cannot – there is no display to run applescript on, so osascript throws an error.

I know there is on a Linux machine with X11 – I'm hoping something similar is available, but how to do this on a Mac?

Best Answer

You can use VNC to log into the mac from a client machine (iOS, android, PC, Mac) and establish the UI session, set excel to launch at boot and set the user account to automatically log in.

With remote working all the rage, apps like TeamViewer also work in headless Mac situations if you don’t want to vpn in to your local network.

Barring an assist, your remote access to the computer might need to allow ssh, and perhaps remote apple script so ssh and osascript could remotely script things directly from AppleScript.

enter image description here