Questions

Auto clicker script for Mac

Download InputConfig on the Mac App StoreInputConfig is completely free on the Mac App Store. You don't have to make an account, there are no subscriptions, and nothing is locked. Optimized for Apple silicon.

AppleScript can click a button it can name, but not any spot on the screen. For clicks at a point from Terminal, the free cliclick tool does it in one line. If you only want clicks on a timer with no code, InputConfig, free on the Mac App Store, does it from a key or a button.

Steps

  1. Install cliclick with Homebrew: brew install cliclick.
  2. Allow Terminal in System Settings, Privacy & Security, Accessibility.
  3. Run cliclick c:. to click where the pointer is.
  4. Put it in a loop with a sleep to click on a timer.
  5. Press Control C to stop the loop.

Know what AppleScript can click

AppleScript talks to apps through System Events, which can click a button or a menu item by its name. It has no plain way to click a point on the screen. For a button with a name, AppleScript works. For a spot on the screen, use cliclick.

Click from Terminal with cliclick

cliclick is a free, open-source command-line tool by Carsten Blüm that clicks, moves the pointer and types from Terminal.

Terminal: Install it.

brew install cliclick

What happens: Homebrew installs it, and cliclick -h lists every command.

Terminal: Click at x 500, y 300.

cliclick c:500,300

What happens: One click lands at that point. A dot instead of numbers clicks where the pointer is.

Terminal: Click where the pointer is, ten times a second, until you press Control C.

while true; do cliclick c:.; sleep 0.1; done

What happens: Clicks repeat until you press Control C in that Terminal window.

Terminal needs Accessibility access for the clicks to land, in System Settings, Privacy & Security, Accessibility.

Skip the script

A loop in Terminal stops only from that window. In InputConfig, the built-in Auto Clicker preset starts and stops with fn F6, the gap is set in milliseconds, and the emergency stop, Control Option Command period, ends it from anywhere. The free auto clicker for Mac has the setup.

The short version

  • A named button. AppleScript and System Events.
  • A spot on screen. cliclick c: with the coordinates.
  • Clicks on a timer, no code. InputConfig's Auto Clicker preset.

Questions

Can AppleScript click the mouse at a point?

Not in a plain way. AppleScript clicks buttons and menu items by name through System Events. For a point on the screen, use cliclick.

How do I auto click from Terminal on a Mac?

Install cliclick with brew install cliclick, allow Terminal in Accessibility, and run cliclick c:. in a loop with a short sleep.

This page in other languages: Deutsch, Español, Français, 日本語, Português, Tiếng Việt

Download InputConfig on the Mac App StoreCompletely free. You don't have to make an account, there are no subscriptions, and nothing is locked. Optimized for Apple silicon. Open source on GitHub.

Updated