How to automate mouse click on Mac

remarkablemark
1 min readDec 17, 2020

--

Cliclick (Command-Line Interface Click) logo
Cliclick

To automate the mouse click action on macOS, use Cliclick, a CLI for emulating mouse events, and AppleScript.

Cliclick

Install cliclick with Homebrew:

$ brew install cliclick

To click at the current mouse location:

$ cliclick c:.

This is the same as running with the full binary path:

$ /usr/local/bin/cliclick c:.

AppleScript

Open Script Editor with Spotlight and paste the AppleScript code:

AppleScript requires the full binary path to run cliclick.

The script does the following:

  1. Wait 15 seconds (line 1).
  2. Click at the current mouse location (line 4).
  3. Wait 1 second (line 5).
  4. Repeat steps 2 to 3 nine more times (lines 3–6).

To run the script, press the play button or ⌘+R (Command-R). To stop the script, press the stop button or ⌘+. (Command-Period). See keyboard shortcuts in Script Editor on Mac.

--

--

No responses yet