Install Hammerspoon
This installs the Hammerspoon app on your Mac. It sits quietly in your menu bar and does nothing until you give it a script. We use Homebrew here because it is one command. If you do not have Homebrew, go to hammerspoon.org, download the latest release zip, unzip it, and drag Hammerspoon.app to your Applications folder instead.
Homebrew says 'command not found'
Install Homebrew first by running: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" — or just download Hammerspoon manually from hammerspoon.org/releases
