remoclipbo securely copies the contents of your clipboard to a remote machine.
- macOS using
bash pbcopyandpbpastecommands must be available- SSH access to the remote machine
See remoclipbo GitHub repository for how to automate it with shortcuts!
- Download
remoclipboand place it in your$PATH(e.g.,~/bin/). - Make it executable:
chmod +x ~/bin/remoclipbo - Edit the
REMOTEvariable in the script to point to the remote host.REMOTE='<user@host>:~/'
First make sure to EDIT the remoclipbo script to update the REMOTE variable at the top of the script to point to the user@host you want to copy to. Also make sure remoclipbo is in your $PATH and executable.
remoclipboThis will paste the contents of your clipboard to ~/remote-clipboard.txt
and then scp it to the remote machine's ~/remote-clipboard.txt.
remoclipbo --clear-after-secs[=<n secs>]This will also clear the remote clipboard after <n secs>.
If no value is provided, it defaults to 15 seconds.
remoclipbo -cThis will read ~/remote-clipboard.txt and copy its contents to the clipboard.
Useful if you ran this from another machine and want to put the contents
of ~/remote-clipboard.txt into your clipboard.
Ideally, you will automate this part. See README.md.
remoclipbo -verifyThis will print the contents of the remote machine’s ~/remote-clipboard.txt
without copying anything. Useful for verifying what was sent to the remote.
To automatically update the clipboard when remote-clipboard.txt changes, create a launchd plist file:
vim ~/Library/LaunchAgents/com.user.remoteclipboard.plist(Or whichever editor your prefer, if not vim).
Then paste the following (and make sure to edit the 2 paths with yours):
<?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.user.remoteclipboard</string>
<key>ProgramArguments</key>
<array>
<string>/Users/<your_username>/bin/remoclipbo</string>
<string>-c</string>
</array>
<key>WatchPaths</key>
<array>
<string>/Users/<your_username>/remote-clipboard.txt</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>launchctl load ~/Library/LaunchAgents/com.user.remoteclipboard.plistTo reload after editing:
launchctl unload ~/Library/LaunchAgents/com.user.remoteclipboard.plist
launchctl load ~/Library/LaunchAgents/com.user.remoteclipboard.plistNOTE: You don't have to use raycast, if you prefer other keyboard shortcut apps.
In Settings>Extensions>Script Commands click Add Directories, then add ~/.config/raycast/scripts/remoclipbo.sh and mkdir that locally and put my bash scripts in there and make them executable. Example of calling ~/bin/remoclipbo:
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Secure Copy Clipboard
# @raycast.mode silent
"$HOME/bin/remoclipbo"
Note that the comments in the raycast/scripts/remoclipbo.sh file seem to be required, and/or restart Raycast, before it will detect the script. It will then show the script under Settings>Extensions>Script Commands so you can add a hotkey to it. I map it to HYPER+C
Note: There's need to run 'Create Script Command' unless wanting to publish it publicly
- Hyper+H mapped to
Clipboard Historyto see the clipboard contents. - Hyper+R mapped to
Remote-clipboard.txtquicklink to seeremote-clipboard.txt.
- Ensure SSH keys are set up for passwordless access.
- Adjust
sleep 1in the script if clipboard contents are not transferring reliably. - Use different
REMOTEvalues for work and home machines to avoid conflicts.
MIT License