Usage
Parameters
The plain-text content to write to the clipboard. Supports newlines, special characters, and Unicode.For multi-line text, use shell quoting:
Response
Always
true if the operation succeededExamples
Set Simple Text
Set Multi-Line Text
Set from Variable
Set from File
Use Cases
Programmatic Copy
Programmatic Copy
Copy data to clipboard without user interaction:
Paste Automation
Paste Automation
Set clipboard content before pasting into an app:
Data Transfer Between Apps
Data Transfer Between Apps
Transfer data via clipboard:
Bulk Paste Operations
Bulk Paste Operations
Paste multiple values in sequence:
Template Expansion
Template Expansion
Copy templated content:
Clipboard Behavior
- Replaces existing content: Any previous clipboard content is overwritten
- Plain text only: This command only sets plain text; images, files, and rich text are not supported
- System-wide: The clipboard is shared across all applications
- Persistent: Clipboard content remains until replaced or cleared
- Newlines preserved: Multi-line text is preserved exactly as provided
Special Characters
The command handles special characters correctly:Permissions
Setting the clipboard requires macOS accessibility permission. If permission is not granted, the command will return aPERM_DENIED error:
Notes
- The operation is synchronous and completes immediately
- Maximum clipboard size is limited by macOS (typically several MB for text)
- The clipboard content is available to all apps immediately after the command succeeds
- Use
clipboard-clearto explicitly empty the clipboard
Related Commands
- clipboard-get - Read text from the clipboard
- clipboard-clear - Clear the clipboard
- press - Send keyboard shortcuts like cmd+v to paste
- type - Type text directly into an element (alternative to clipboard+paste)