Apple - Utility to identify what mouse buttons are being pressed?

Hammerspoon can be scripted to do this.

  • Install Hammerspoon and run it.
  • Open System Preferences, go to Security & Privacy and enable under Accessibility.
  • Click the Hammerspoon menu icon and select Open Config. Your default code/text editor will open to ~/.hammerspoon/init.lua.
  • Enter something like the following text which uses the Hammerspoon API to listen for events.
detectMouseDown ={ 
}, function(e)
  local button = e:getProperty(['mouseEventButtonNumber']
  print(string.format("Clicked Mouse Button: %i", button))


  • Save the file.
  • Click the Hammerspoon menu icon, select Console... and click Reload config on the console window.
  • Now, whenever you click anywhere you'll see a log entry in the Hammerspoon Console!

(So far, this works for any type of touchpad click/tap or external mouse click.)

Karabiner-EventViewer is another option that can log the information you are looking for. Although it comes as part of Karabiner-Elements you can use it independently to monitor keystrokes and mouse button presses.

You can examine keyboard and mouse events by using EventViewer. Launch Karabiner-EventViewer from Launchpad.

Input events will be shown when you type keyboard on EventViewer or press pointing buttons on Mouse Area.

--source Karabiner-EventViewer manual

In practice I find it logs keys and clicks made any where whilst it is running.

screenshot of the Karabiner-Event viewer interface