Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to directly copy the terminal stdout to the clipboard on Mac. How would I do this?


echo sometext | copy_to_clipboard


echo sometext > /private/clipboard.txt

share|improve this question
I am interested to know if it is possible to do this when ssh'ed to another box as well… – cwd Mar 28 '12 at 16:24

Use pbcopy:

echo foo | pbcopy

Also see man pbcopy for info on it and pbpaste.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.