Skip to content

Instantly share code, notes, and snippets.

@jamesratcliffe
Created June 17, 2020 13:59
Show Gist options
  • Save jamesratcliffe/1d402a443416f9316debee1ecba4f514 to your computer and use it in GitHub Desktop.
Save jamesratcliffe/1d402a443416f9316debee1ecba4f514 to your computer and use it in GitHub Desktop.
Remote pbcopy

Use pbcopy over ssh

From https://seancoates.com/blogs/remote-pbcopy/.

  1. Save pbcopy.plist to ~/Library/LaunchAgents/.
  2. Load it: launchctl load ~/Library/LaunchAgents/pbcopy.plist.
  3. Save pbcopy /usr/local/bin. Make sure it's executable.
cat | nc -q1 localhost 2224
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>localhost.pbcopy</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/pbcopy</string>
</array>
<key>inetdCompatibility</key>
<dict>
<key>Wait</key>
<false/>
</dict>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
<string>2224</string>
<key>SockNodeName</key>
<string>127.0.0.1</string>
</dict>
</dict>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment