How to Use Clipboard History in Terminal on macOS
Quick answer: Terminal on macOS has no clipboard history of its own. It only holds whatever you copied last. To get history, run a clipboard manager such as Maccy, press its hotkey (Shift+Command+C by default), pick an earlier item, and paste it into your shell. For scripts, pbcopy and pbpaste move text between the clipboard and the command line.
TL;DR
- Shell history (
Ctrl+R,history) stores commands you ran. Clipboard history stores things you copied. They are different tools. - Apple’s Terminal.app has no built-in clipboard history. iTerm2 has its own paste history, but it only covers that app.
- A system-wide clipboard manager covers Terminal, your editor, your browser and your password manager’s copy actions in one list.
- Pasting from history into a shell can run commands. Check multi-line items before pressing Enter.
You copy a long kubectl flag from a doc, then an error message from a log, then a file path from Finder. Now you need the flag again, and it’s gone. That’s the gap clipboard history fills, and Terminal is where it hurts most, because the things you copy there (paths, hashes, tokens, one-liners) are tedious to retrieve a second time.
What is clipboard history in Terminal?
Clipboard history is a running list of items you’ve copied, not just the latest one. Terminal itself doesn’t provide it. macOS keeps a single system pasteboard, and every Cmd+C overwrites it. Any history you see in Terminal comes from a separate app watching that pasteboard, or from a terminal emulator that adds its own feature.
Clipboard history vs. shell history: which do you need?
People often mix these up, so check which problem you have before picking a tool.
| You want to… | You need | How |
|---|---|---|
| Re-run a command you typed earlier | Shell history | Ctrl+R, history | grep ssh, the Up arrow |
| Re-paste text you copied earlier (from any app) | Clipboard history | A clipboard manager like Maccy |
| Pipe command output to the clipboard | Pasteboard CLI | some-command | pbcopy |
| Paste clipboard contents into a pipeline | Pasteboard CLI | pbpaste | sort | uniq |
| Re-paste things you pasted into one iTerm2 window | iTerm2 Paste History | iTerm2’s Edit menu |
Option 1: Use a clipboard manager (the practical answer)
A clipboard manager records each copy system-wide, so Terminal gets the same history as every other app. Maccy app is a free, open-source, local-first manager for macOS, and it keeps its history on your Mac.
Set up Maccy for terminal work
- Install it. Download from maccy.app, or run
brew install maccyif you use Homebrew. - Grant Accessibility access. Maccy asks for this if you want it to paste straight into the frontmost app. Without it, Maccy copies your pick to the clipboard and you press
Cmd+Vyourself, which works fine in Terminal. - Open the history. Press
Shift+Command+C(the default) to open the popup, type to search, pressReturnto select. - Paste. If automatic paste is on in Maccy’s settings, it pastes into your shell. Otherwise press
Cmd+V.
Features that matter in a terminal
- Search modes. Maccy’s search can be exact, fuzzy, regex or mixed (Settings → General). Regex search is handy for finding “that thing starting with
sha256:“. - Pinning. Pin snippets you paste constantly, like a long
docker runline or an SSH jump-host string, so they don’t scroll out of history. The default pin shortcut isOption+Pwhile an item is highlighted. - Deleting an item. Highlight it and press
Option+Deleteto remove one entry, for example one you copied by mistake. - History size. The default is around 200 items, adjustable in Settings → Storage.
Option 2: Use pbcopy and pbpaste (built into macOS)
pbcopy and pbpaste ship with macOS. They don’t give you history, but they connect the terminal to the clipboard, which makes a manager far more useful.
# Copy a file's contents to the clipboard
pbcopy < ~/.ssh/id_ed25519.pub
# Copy command output
git rev-parse HEAD | pbcopy # Use the clipboard as input
pbpaste | jq .
# Strip rich-text formatting (the clipboard becomes plain text)
pbpaste | pbcopy
Each pbcopy call is recorded by the clipboard manager like any other copy, so git rev-parse HEAD | pbcopy followed by another copy still leaves the hash in your history.
Option 3: Terminal-specific history (iTerm2)
iTerm2 has a Paste History feature that remembers text pasted within iTerm2. It’s useful if you live entirely in iTerm2, but it has two limits: it only covers iTerm2, and it records pastes, not copies made elsewhere. If you copy a command in your browser and paste it once, you can recall it. If you copy three things and paste only the last, the first two are lost. A system-wide manager has neither limit.
Is it safe to paste from history into a shell?
Treat it with some caution. Two issues come up in practice.
1. Multi-line pastes can execute immediately
A newline in a pasted block can act like pressing Enter. Modern zsh, the default shell on macOS, supports bracketed paste, which holds multi-line pastes for confirmation instead of running them. Don’t rely on that if you use another shell or remote sessions. Before pasting anything multi-line from history, look at it first, and prefer a short preview in the clipboard manager’s popup.
2. Secrets end up in history
If you copy an API token, it sits in your clipboard history until it ages out. Password managers usually mark their copies as concealed so well-behaved clipboard managers skip them, and Maccy mac ignores concealed and transient pasteboard types by default. Tokens you copy out of Terminal output are not marked this way. You have three options:
- Delete the item after use (
Option+Deleteon the highlighted entry). - Use Maccy’s Ignore settings (Settings → Ignore) to exclude specific apps, or add a pattern to the ignore regexp list, such as one matching your token prefix.
- Clear history when you’re done with a sensitive session.
Because Maccy clipboard is local-first, history stays on your Mac and isn’t sent to a server. That reduces the exposure, but anyone with access to your unlocked session can still open the popup.
Practical workflows
| Scenario | Workflow |
|---|---|
| Compare two log lines | Copy line A, copy line B, open history, paste each into a diff <(echo ...) <(echo ...) command. |
| Reuse a long command with a changed argument | Pin the command in Maccy, paste it, edit the argument inline. |
| Find a hash you copied an hour ago | Open Maccy, type the first few characters (or use regex search), select. |
| Paste a path from Finder, then a flag from docs | Copy both in either order, then paste each from history without switching windows back. |
| Clean up formatted text from a webpage | pbpaste | pbcopy, or use Maccy’s paste-without-formatting option. |
Which approach should you pick?
- Casual Terminal use: A clipboard manager plus
pbcopy/pbpastecovers nearly everything. - iTerm2-only workflow: Paste History is enough if you never copy across apps.
- Shell-command recall: You want
Ctrl+Rand a tunedHISTSIZE, not a clipboard tool.
Honest trade-off: a clipboard manager adds one more thing that holds sensitive text. If you routinely copy credentials from the terminal, set up ignore rules on day one.
Conclusion
Terminal’s lack of clipboard history is a macOS limitation, not a setting you missed. The cleanest fix is a system-wide manager, with pbcopy and pbpaste for scripted work and a little care around multi-line pastes and secrets. If you want a local-first, open-source option, Maccy is free and takes a minute to set up.
What’s the one snippet you re-type most often in your terminal? That’s probably your first pin.
FAQ
Does macOS Terminal have clipboard history?
No. Terminal.app uses the single system pasteboard, which holds only your last copy. You need a clipboard manager or an emulator feature such as iTerm2’s Paste History to get history.
How do I see my clipboard contents in Terminal?
Run pbpaste. It prints the current clipboard text to standard output, and you can pipe it into other commands.
What is the difference between clipboard history and shell history?
Shell history records commands you ran, accessed with history or Ctrl+R. Clipboard history records text you copied from any app and is provided by a clipboard manager.
Can I paste an older copied item into Terminal without switching windows?
Yes. Open your clipboard manager’s popup over Terminal, choose the item, and paste. With Maccy, press Shift+Command+C, search or select, then Return, and paste with Cmd+V if automatic paste is off.
Is clipboard history safe for passwords and tokens?
It can be if you configure it. Use ignore rules for sensitive apps, delete items after use, and rely on password managers that mark their copies as concealed.
If you want to try it yourself, maccy.at is a free, open-source clipboard manager for macOS — the clipboard history guide covers the rest.
