| name | clipboard-copy |
| description | Copy text to the system clipboard. Use when user asks to copy something to clipboard, copy to pasteboard, or wants to paste something. |
Copy to Clipboard
When copying text to the clipboard on macOS, always use a heredoc with pbcopy. Never use printf or echo with escaped quotes as they break on apostrophes and special characters.
Correct Method
cat << 'EOF' | pbcopy
Your text here with apostrophes like it's and don't.
Special characters work fine: é, ü, ñ, quotes "like this".
Multiple lines work too.
EOF
Why Not printf or echo
printf '%s' 'today'\''s meeting' | pbcopy
echo "He said \"hello\"" | pbcopy
cat << 'EOF' | pbcopy
today's meeting, "hello", it's all fine
EOF
Key Rules
- Always use
cat << 'EOF' | pbcopy (single quotes around EOF to prevent variable expansion)
- Never escape apostrophes or quotes manually
- Works for any text: emails, code, prose, unicode