Skip to Content
Sindre Sorhus
Back to Hyperduck

Updated

How to Lock Your Mac from iPhone

By Sindre Sorhus, who makes the Hyperduck app

With Hyperduck

  1. Install Hyperduck on your iPhone and on your Mac, with the same Apple Account. Open it on the Mac, and keep it running.
  2. On the Mac, make a shortcut in the Shortcuts app with only the “Lock Screen” action, and name it “Lock Mac”.
  3. On the iPhone, make a shortcut with the “Run Shortcut on Mac” action of Hyperduck, and type “Lock Mac” in its shortcut field.
  4. Run the iPhone shortcut. The Mac locks.

Tips

  • Turn on “Open Shortcuts URLs in the background” in the settings of Hyperduck on the Mac, so the Shortcuts app does not come to the front before the Mac locks.
  • Add the iPhone shortcut to the Home Screen, or say its name to Siri.
  • The same setup can shut down the Mac, or run any Mac shortcut.

The Mac must be awake and online to get the command. To unlock it, you must be at the Mac.

Get Hyperduck

Send links from your iOS and visionOS devices to your Mac

Download on the App Store

$5, one-time purchase for all platforms

Requires
macOS, iOS, or visionOS 26 or later
Family Sharing
Yes
Updated
October 2026
US App Store rating
4.9/5 (174 ratings)

More about Hyperduck

Without an app

iPhone has no button to lock a Mac. At the Mac, there are fast ways (Apple’s guide):

  • Press ControlCommandQ, or choose “Apple menu › Lock Screen”.
  • Press Touch ID, or the lock key, on a keyboard that has it.
  • SSH: If you know the Terminal, turn on “Remote Login” in “System Settings › General › Sharing” on the Mac. Then use the “Run Script Over SSH” action of Shortcuts on the iPhone to run pmset displaysleepnow. It turns off the display, and the Mac asks for the password when “Require password after screen saver begins or display is turned off” in “System Settings › Lock Screen” is “Immediately”. It works only when the iPhone can reach the Mac, like on the same network.

Hyperduck is the easy way when you are not at the Mac, like when you left it open at work.