Is there a utility for mac to show what mouse buttons are being pressed?

Similar utilities for Windows are: Spy++ and WindowSpy from AutoHotKey.

For Linux I have used: xinput --query-state

  • Magic mouse only or also generic mice?
    – n1000
    Jun 27 '19 at 11:17
  • I would like so see the info for any mouse. I don’t have a Magic mouse. Jun 27 '19 at 17:46

Hammerspoon can be scripted to do this.

  • Install Hammerspoon and run it.
  • Open System Preferences, go to Security & Privacy and enable Hammerspoon.app 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 hs.eventtap.new API to listen for events.
detectMouseDown = hs.eventtap.new({ 
}, function(e)
  local button = e:getProperty(
  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

  • +1, Karabiner Elements is so useful in so many ways. If you're going to install something, better this than anything else. Nov 6 '19 at 9:16

I'm not sure if it would work correctly, but xinput is included in XQuartz, an implementation of the X Window System for macOS. You can invoke it via Terminal.

  • Not really as I think that goes through another mapping process.
    – mmmmmm
    Jun 28 '19 at 12:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .