Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Example:

echo sometext | copy_to_clipboard

or

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 superuser.com/questions/405491/… –  cwd Mar 28 '12 at 16:24

1 Answer 1

Use pbcopy:

echo foo | pbcopy

Also see man pbcopy for info on it and pbpaste.

share|improve this answer

Your Answer

 
discard

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.