# Mac Clipboard

> Reads the current Mac clipboard (pasteboard) contents to stdout or writes new text to the clipboard using pbcopy/pbpaste. Use when the user asks to copy, paste, read clipboard, write to clipboard, check pasteboard contents, or transfer text via the macOS clipboard.

- Skill: `leionion/mac-clipboard` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add leionion/mac-clipboard`
- Raw SKILL.md: https://api.skillmd.com/api/skills/leionion/mac-clipboard/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: leionion (https://skillmd.com/u/leionion)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/leionion/mac-clipboard

---


# mac-clipboard — Clipboard Read/Write

Reads and writes macOS clipboard contents using `pbcopy` and `pbpaste`.

## Usage

```bash
# Read current clipboard contents
python3 mac_clipboard.py

# Write text to clipboard
python3 mac_clipboard.py "Hello, world!"

# Write with explicit -w flag
python3 mac_clipboard.py -w "text to copy"
```

## How it works

- **Read**: calls `pbpaste` and prints clipboard contents to stdout
- **Write**: pipes text to `pbcopy` via stdin

## Example output

```
📋 当前剪贴板内容:
Hello, world!
```

On successful write:
```
✅ 已写入剪贴板
```

