MirrorDisplays a simple application that toggles between mirrored and extended desktop modes. It’s the easiest way to turn on, or turn off display mirroring.
Also comes with a (separately installable) CLI tool which makes this pretty interesting
The command line tool is good for giving shell-scripts the power to control display mirroring and opens up the possibility of controlling mirroring remotely over ssh.
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
Unfortunately not installable using Homebrew, so you’ll have to get the app from the GitHub releases page. You’ll also have to explicitly allow the mirror
CLI tool to be opened through the Security & Privacy
mirror-displays (GitHub) →
Mirror Displays Introductory Post →
💡 If you’re using a MacBook with only one external display connected you might not need this app, and can use the CMD+F1 shortcut to toggle display mirroring/extending.