How to Clear Passwords From the Mac Clipboard Automatically
Key takeaways
- macOS keeps whatever you copied, including passwords and API keys, until you copy something else. Running apps can read it.
- On macOS Tahoe, Spotlight's clipboard history can also keep that password for up to 7 days, depending on your setting.
- To clear the clipboard right now, run
pbcopy < /dev/nullin Terminal, or simply copy a harmless word. - To clear secrets automatically, use a password manager's clipboard timeout for passwords you copy from it, or a clipboard manager like Magpie that detects secrets wherever they come from.
Why a copied password is a risk
The clipboard is shared by every app on your Mac. When you copy a password, it stays there until the next copy, often for hours. During that time:
- You can paste it by accident into a chat, a search box or a shared document.
- Any running app can read the clipboard, usually without asking. Apple has announced alerts for apps that read it in the background, but they aren't switched on by default.
- On macOS Tahoe, Spotlight's clipboard history saves copied items for 8 hours by default and up to 7 days, so a password can outlive the moment you used it.
- A clipboard manager without secret detection keeps it indefinitely in its history.
Clear the clipboard now
The quickest way, on any version of macOS, is one command in Terminal:
pbcopy < /dev/null
It replaces the clipboard with nothing. Copying any harmless word does the same thing.
On macOS Tahoe 26.1 and later, also clear Spotlight's copy: open System Settings → Spotlight and click Clear Clipboard History. If you rarely need it, set clipboard history to 30 minutes or turn it off in the same place.
Clear passwords automatically
Use your password manager's timeout
Most password managers can clear a password from the clipboard a short while after you copy it. Look for a setting like "clear clipboard" or "remove copied items" in its preferences. This only covers passwords you copy from the password manager. A key copied from a terminal, an email or a web dashboard isn't touched.
Let a clipboard manager detect secrets
Magpie watches everything you copy and recognises secrets by their shape: API keys, access tokens, private keys, passwords and card numbers. When it finds one, it:
- Marks the clip as sensitive and hides its contents on the card.
- Clears it from the system clipboard after 30 seconds, wherever you copied it from.
- Keeps the history entry, so you can still find the key later if you need it.
On Macs that support Apple Intelligence, Magpie can also use the on-device model to catch secrets that don't follow a known pattern. Nothing is sent to a server.
Lock the secrets you keep
Some secrets you do want to keep: a Wi-Fi password, a recovery code, a staging token. In Magpie you can put them in a section locked with Touch ID. Its cards stay hidden until you touch the sensor.
Which option to pick
| Option | Clears automatically | Covers secrets from any app | Keeps a history |
|---|---|---|---|
pbcopy < /dev/null | No, you run it | Yes | No |
| Password manager timeout | Yes | No, only its own passwords | No |
| Spotlight (macOS Tahoe) | After 30 min to 7 days | Yes | Yes, up to 7 days |
| Magpie | Yes, after 30 seconds | Yes | Yes, with Touch ID sections |
Frequently Asked Questions
Does the Mac clipboard clear itself?
No. macOS keeps the last copied item until you copy something else, log out or restart. On macOS Tahoe, Spotlight's clipboard history additionally keeps items for 8 hours by default.
How do I clear the clipboard on a Mac?
Run pbcopy < /dev/null in Terminal, or copy any harmless text. On macOS Tahoe 26.1 and later, also click Clear Clipboard History in System Settings → Spotlight.
Can other apps see what I copy on Mac?
Yes, running apps can read the clipboard, usually without asking. Apple has announced alerts for apps that read it in the background, but they aren't switched on by default, so treat anything you copy as visible to the apps you have open.
How do I stop passwords showing up in clipboard history?
Turn off clipboard history in System Settings → Spotlight on macOS Tahoe, or use a clipboard manager that detects secrets. Magpie hides passwords and API keys on the card and clears them from the clipboard after 30 seconds.