clipboard-copy

Copy arbitrary text to the macOS clipboard using pbcopy.

3|Updated Dec 30, 2025
One-click install
npx skills add https://github.com/yungweng/dotfiles --skill clipboard-copy-yungweng
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clipboard-copy
Source: https://github.com/yungweng/dotfiles/tree/main/claude/.claude/skills/clipboard-copy
Command: npx skills add https://github.com/yungweng/dotfiles --skill clipboard-copy-yungweng

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a reliable method for copying arbitrary text content to the system's clipboard, ensuring that special characters and multiple lines are preserved correctly.

Core Features & Use Cases

  • Secure Copying: Uses pbcopy on macOS for robust text transfer to the clipboard.
  • Handles Special Characters: Correctly copies text containing apostrophes, quotes, and Unicode characters.
  • Multi-line Support: Accurately transfers text spanning multiple lines.
  • Use Case: Copying code snippets, email content, or any formatted text to the clipboard for pasting elsewhere.

Quick Start

Copy the following text to your clipboard.

Frequently Asked Questions about clipboard-copy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I copy multi-line text to the clipboard on macOS without losing special characters?▼

To copy multi-line text to the macOS clipboard without losing special characters, use a heredoc with the `pbcopy` command. This approach safely preserves apostrophes, quotes, and Unicode formatting.

Why does copying text with apostrophes using echo or printf break my shell script?▼

Copying text with apostrophes breaks shell scripts because `echo` and `printf` struggle with special character escaping. Using a heredoc with `pbcopy` avoids this fragility and ensures accurate text transfer.

What is the best way to copy code snippets to the system clipboard on macOS?▼

The best way to copy code snippets to the macOS system clipboard is using `pbcopy` combined with a heredoc. This method reliably handles arbitrary strings and multiple lines without formatting loss.

Does this clipboard copy method support text containing Unicode characters and quotes?▼

Yes, this clipboard copy method supports text containing Unicode characters and quotes. By utilizing a heredoc with `pbcopy`, it accurately transfers arbitrary strings while avoiding common shell parsing errors.

Can I use this approach to copy arbitrary strings to the clipboard on macOS?▼

Yes, you can use this approach to copy arbitrary strings to the macOS clipboard. It leverages `pbcopy` via a heredoc to securely transfer text content, bypassing the limitations of standard shell commands.