Using macOS Clipboard Commands

If you’re a Mac user, you may be familiar with macOS’s command-line clipboard utilities pbcopy and pbpaste. These simple utilities make it a snap to work with the clipboard. The pbcopy command captures text to the system clipboard, and the pbpaste command pastes content out. For example, you can use pbcopy and cat together to easily put the contents of your .tmux.conf file into the clipboard so you can paste it in an email or on the web, like this:

 $ ​​cat​​ ​​~/.tmux.conf​​ ​​|​​ ​​pbcopy

You can use pbcopy inside of tmux as well. For example, you can send the contents of the current tmux buffer to the system clipboard:

 $ ​​tmux​​ ​​show-buffer​​ ​​|​​ ​​pbcopy

Or you can paste the clipboard contents into ...

Get tmux 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.