Poor man’s remote clipboard sharing
I have two Macs and often times I need to copy text from one clipboard to the other.
I accomplished this using nc
and pbcopy
and pbpaste
commands. I know that you can do handoff between Macs, I was forced to do this manually because one of the macs is for work and the other is personal. So they don’t share the same iCloud account. Furthermore, the work laptop is locked down and Airdrop is disabled.
[!WARNING]
Although I have passed passwords this way. I do not recommend for such. As it’s not secure if someone is sniffing your network.
So here’s how it’s done:
- On the machine you want to copy text to the clipboard of run the following command:
nc -l 4444 | pbcopy
- On the machine you want to copy the text from its clipboard run the following command:
pbpaste | nc <ip-of-the-other-machine> 4444
Such as:
pbpaste | nc 192.168.1.102 4444
If 192.168.1.102
is the IP of the other machine.
And that’s it. You can now copy text from one machine to the other.