How to save copied code on Mac
macOS forgets every copy the moment you press ⌘C again. Install a clipboard manager so every snippet you copy from VS Code, Cursor, Terminal or Claude Code is saved automatically — searchable for hours or forever. Maus is free with 24h of history; Pro ($12.99 once) keeps every snippet forever.
Why this happens
You copied a function from a file. Then copied a URL from the browser. Then copied an error from the terminal. The function is gone. The URL is gone. Only the error is on the clipboard. Every ⌘C overwrites the previous item, with no warning, no history, no undo.
macOS has worked this way since the beginning. macOS Tahoe (26) added a basic clipboard history through Spotlight (Cmd+Space → Tab → Clipboard, off by default). It's useful but limited: no search by source app, no syntax preservation, single-paste only, and on older macOS versions (Sequoia and below) it doesn't exist at all.
For someone writing code, the fix needs three properties:
- Automatic. You don't know in advance which snippet you'll need 10 minutes later. A snippet manager that requires naming each one (TextExpander, Alfred snippets) misses the point.
- Searchable. Yesterday you copied an SQL query. You don't remember which one. You need to type 3 characters and find it.
- Source-aware. You want to find "the code I copied from Cursor", not "the URL from the same session".
Method 1: install a clipboard manager
This is the only method that actually solves the problem retroactively. Once installed, every future ⌘C is captured and stored locally.
Step-by-step with Maus
- Download Maus from mausformac.com (free, native Swift, no Electron).
- Grant accessibility permission when prompted (System Settings → Privacy & Security → Accessibility). This lets Maus paste back into apps.
- Copy code normally with
⌘C. Maus is now capturing it. - Press
⌘⇧Vanywhere to open the history right at your cursor. Type to filter by content. - Select with arrows, press
⏎to paste. Done.
Free tier keeps 24 hours of history with every feature. Pro ($12.99 one-time, no subscription) extends that to unlimited — useful when you reach back for a snippet from 3 weeks ago.
Filtering by source
Maus tags every clip with the app it came from. To find only the code you copied from VS Code, type code in the search field. Combine filters: code error finds code containing the word "error" copied from VS Code. cursor refactor finds anything containing "refactor" copied from Cursor.
This is the single most useful feature for developers — you have hundreds of clips from a working session, and you find any of them in 2 seconds.
Method 2: save to a file (manual, for one specific snippet)
If you only need to preserve this one snippet:
- Open any text editor (TextEdit, BBEdit, your IDE).
- Paste with
⌘V. - Save with
⌘Sto a place you'll remember.
Two problems with this approach. First, it's slow — every snippet takes 4 steps. Second, you can't search across all of them later without a separate workflow. It works for the one snippet you knew was important. It fails for the snippet you didn't know would matter.
Method 3: snippet managers (different category)
Tools like TextExpander, Alfred snippets, or Espanso let you define named snippets that expand on a trigger. They're powerful for boilerplate (your email signature, common imports, license headers) but they require deliberate setup for each snippet. You won't have a Maus-style "everything I copied yesterday" history.
Use both if your workflow has boilerplate (snippet manager) plus ad-hoc copying (clipboard manager). For raw "save what I just copied", a clipboard manager is the right tool.
Use cases worth setting up for
Refactoring across files
You're moving three imports, two helper functions, and a type definition from one file to another. Copy each, then ⌘⇧V in the destination, ⌘+Click all five items, press ⏎ — they paste in order. One operation instead of ten tab-switches.
Feeding context to Claude / ChatGPT / Cursor
Copy a file. Copy the failing test. Copy the error from the terminal. Switch to Claude or Cursor. Paste all three at once. The whole context arrives in the order you intended — see the Claude Code / Cursor / Codex post for the specific workflow.
Recovering yesterday's regex
You wrote a regex for log parsing yesterday, used it once, copied it for later, then forgot. ⌘⇧V, type "regex" or any unique word from the pattern, find it. On Pro the history is unlimited — your regex from three weeks ago is still there.
Replaying terminal commands
You're debugging across two terminal sessions. Copy commands and outputs as you go. Multipaste lets you mix recent commands with one from earlier in the session without scrolling through history.
Comparison
| Tool | Captures everything you copy | Search | Source filter | Free tier |
|---|---|---|---|---|
| Maus | Yes | Yes | Yes (#vscode, #cursor, #terminal…) | 24h history, all features |
| Maccy | Yes | Yes | No | Free forever (open source) |
| Paste | Yes | Yes | No | Trial only |
| TextExpander | No (named snippets only) | By trigger | N/A | Trial only |
| macOS Tahoe Spotlight Clipboard | Yes (after enabling) | Yes | No | Built-in, ~30 days |
What about secrets and API keys?
When 1Password, Bitwarden, or Apple Keychain copy a password, they set the macOS concealed flag on the clipboard. Maus respects this flag and skips those items — they never enter your history.
API keys you copy manually (from .env, from a dashboard) are not marked concealed — they enter the history. If this matters for your threat model, either use a clipboard manager that supports an excluded-apps list, or delete sensitive items right after pasting.
FAQ
Why does Mac forget the code I copied?
macOS stores one clipboard item. Every ⌘C overwrites the previous one. There's no native history before Tahoe (26), and Tahoe's option is off by default and limited.
How do I save every code snippet I copy on Mac?
Install a clipboard manager. Maus captures every copy automatically, lets you search the history, and works in any app.
Can I search through code I copied before?
Yes. Maus opens at your cursor with ⌘⇧V; type to filter content. You can also filter by source app.
Snippet manager or clipboard manager?
Snippet managers (TextExpander, Alfred) need you to name each snippet upfront. Clipboard managers (Maus, Maccy) capture everything automatically. For "save what I just copied", you want a clipboard manager.
Does Maus work with VS Code, Cursor, and the terminal?
Yes. Maus captures from any Mac app — VS Code, Cursor, Claude Code, Xcode, Terminal, iTerm2, Warp, Ghostty, JetBrains. The source app is recorded so you can filter your history.
Is there a free way to save copied code on Mac?
Yes. Maus is free with 24h history. Maccy is free and open source. macOS Tahoe also added a basic clipboard via Spotlight.
I just lost a critical snippet. Can I recover it without a clipboard manager?
No. If a clipboard manager wasn't installed before you copied, the snippet is gone. Install one now so the next snippet you lose isn't really lost.
Stop losing the code you copied
Maus captures every ⌘C on your Mac. Free with 24h history. Pro $12.99 once for unlimited.