pbcopy – copy to clipboard in macOS

pbcopy is a command that copies text to the clipboard in macOS.
Why Use pbcopy?
- terminal multiplexers like tmux use their own clipboard - meaning you copy text but it’s not passed to the system clipboard
- pbcopy is a great way to simply forward large chunk of text into system clipboard - you don’t have to select anything while scrolling multiple screens of text
Copy text to clipboard with pbcopy
You simply pass the output of your command to pbcopy via pipe in the command line, like this:
echo 'Hello, world!' | pbcopy
After that, you can paste the text from the clipboard with Command + V
.