Command Line Tool to Toggle Mirroring

I've been looking for an easy way to toggle between "Mirror" and "Don't Mirror" when using Luna Display with my MacBook Air.

Turns out there a command-line tool for this called… wait for itmirror.

There's even an app called ""

You can find the app and command-line tools pre-compiled at

Source code is available at

Here's the options available for mirror:

usage: mirror [option]	Only the first option passed will be applied
  -h		Print this usage and exit.
  -t		Toggle mirroring (default behavior)
  -on		Turn Mirroring On
  -off		Turn Mirroring Off
  -q		Query the Mirroring state and write "on" or "off" to stdout
  -l A B	Makes display at index B mirror the display at index A

If you use launch the app, it will run toggle the current status and just immediately quit.

I wanted a Keyboard Maestro macro, of course, so I set hyper+M as "Toggle Mirroring" to run the command line tool in a Keyboard Maestro shell script rather than using the app.