This tool captures everything you copy on your Mac and saves it in a history file. You can view and reuse past clipboard entries via the terminal.
- Automatically logs clipboard contents with timestamps.
- Stores clipboard history as JSON.
- Simple CLI (
cpbrd) to:- View clipboard history.
- Copy any previous entry back to the clipboard by ID.
- Runs in the background as a
launchddaemon.
mkdir -p ~/.clipboard
cd ~/.clipboard
# Copy the following files here:
# - clipboard_daemon.sh
# - cpbrd
# Make sure they're executable
chmod +x clipboard_daemon.sh cpbrdsudo cp cpbrd /usr/local/bin/cpbrdNow you can use cpbrd anywhere in your terminal
create a launch agent
mkdir -p ~/Library/LaunchAgents
nano ~/Library/LaunchAgents/com.nimish.clipboard.plistPaste this content
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.nimish.clipboard</string>
<key>ProgramArguments</key>
<array>
<string>/Users/YOUR_USERNAME/.clipboard/clipboard_daemon.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/tmp/clipboard_daemon.log</string>
<key>StandardErrorPath</key>
<string>/tmp/clipboard_daemon.err</string>
</dict>
</plist>Replace YOUR_USERNAME with your actual macOS username or user $(whoami).
Load the daemon
launchctl load ~/Library/LaunchAgents/com.nimish.clipboard.plistcpbrd # View history (ID + first line preview)
cpbrd 2 # Copy entry with ID 2 to clipboardlaunchctl unload ~/Library/LaunchAgents/com.nimish.clipboard.plist
rm ~/Library/LaunchAgents/com.nimish.clipboard.plist
rm -rf ~/.clipboard
sudo rm /usr/local/bin/cpbrd