Arms crossed picture of James Auble
terminal screenshot of the pbcopy command

Copy To Clipboard In MacOS Terminal

PublishedFeb 24th, 2022

Copy From Terminal 

Copy the output of something to the clipboard with pbcopy using the “pipe” character |:

$ pwd | pbcopy

You now have the “working directory” of that terminal in the clipboard.

Go ahead.

Cmd + V that sucker into another window and you’ll see something like:


Paste To Terminal 

Guess which command will paste to the terminal???

You guessed it: pbpaste.

If you still have your working directory in the clipboard, when you run pbpaste you should see:

$ pbpaste

Ain’t that fun?

Scrolldown Icon