Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
pbcopy over SSH


  • Add pbcopy.plist to your ~/Library/LaunchAgents/ folder.
  • Launch the listener with launchctl load ~/Library/LaunchAgents/pbcopy.plist.
  • Add RemoteForward 2224 in your ~/.ssh/config file under your Host * or specific hosts sections.
  • Add [ -n "$SSH_CLIENT" ] && alias pbcopy="nc localhost 2224" to your remote ~/.bash_profile or other shell profile.
  • Enjoy pbcopy remotely!
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
Copy link

dilawar commented Aug 5, 2018

Thanks. This worked on my ssh session to OSX. I've been searching for a solution for a very long time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment