Usage
Parameters
This command takes no parameters.Response
Always
true if the operation succeededExamples
Clear Clipboard
Verify Clipboard is Empty
Use Cases
Security: Clear Sensitive Data
Security: Clear Sensitive Data
Clear clipboard after copying sensitive information:
Clipboard State Management
Clipboard State Management
Ensure clipboard starts empty before operations:
Prevent Accidental Pastes
Prevent Accidental Pastes
Clear clipboard to prevent users from pasting old content:
Privacy Protection
Privacy Protection
Clear clipboard when locking screen or ending session:
Clipboard Behavior
- All data types cleared: Removes text, images, files, and any other clipboard content
- System-wide effect: Affects all applications immediately
- Permanent: Content cannot be recovered after clearing
- Idempotent: Safe to call multiple times; no error if clipboard is already empty
Security Considerations
Clearing the clipboard is important for security when handling sensitive data:- Passwords: Always clear clipboard after pasting passwords
- API keys: Clear after pasting tokens or credentials
- Personal information: Clear after handling PII (emails, phone numbers, addresses)
- Temporary data: Clear after automated workflows to avoid leaking intermediate values
Permissions
Clearing 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
- After clearing,
clipboard-getwill return an empty string - Clearing the clipboard does not affect clipboard history in apps that maintain it (e.g., Alfred, Paste)
- This command is faster than
clipboard-set ""and more explicit in intent
Related Commands
- clipboard-get - Read text from the clipboard
- clipboard-set - Write text to the clipboard
- press - Send keyboard shortcuts like cmd+v to paste