I'm asked about this often enough that I think more people should know about this old, yet-still-cool feature. It works wirelessly.
- Launch QuickTime Player.
- File → New Movie Recording.
- Any AppleTV's on your same network will appear under the "Screen" section in the controller overlay.
- Choose which AppleTV you'd like mirrored. You can make recordings, take screenshots, etc.
The first time you’re doing so, your Mac will show a popup saying, "Enter the AirPlay code for...” At the same time, you will see a four-digit code on your Apple TV screen. Enter this code on your Mac to authenticate the connection between your Mac and your Apple TV.
Enjoy!