xsel

Command-line tool for getting and setting X selection clipboard

brewmacoslinux
Try with needOr install directly
Source

About

Command-line program for getting and setting the contents of the X selection

Commands

xsel

Examples

Copy text to X selection clipboard$ echo 'Hello World' | xsel -b
Paste content from X selection clipboard$ xsel -b
Copy file contents to clipboard$ cat filename.txt | xsel -b