Mac Developer Library Developer


This manual page is for Mac OS X version 10.9

If you are running a different version of Mac OS X, view the documentation locally:

  • In Terminal, using the man(1) command

Reading manual pages

Manual pages are intended as a quick reference for people who already understand a technology.

  • To learn how the manual is organized or to learn about command syntax, read the manual page for manpages(5).

  • For more information about this technology, look for other documentation in the Apple Developer Library.

  • For general information about writing shell scripts, read Shell Scripting Primer.

PBCOPY(1)                                                                                          PBCOPY(1)

       pbcopy, pbpaste - provide copying and pasting to the pasteboard (the Clipboard) from command line

       pbcopy [-help] [-pboard {general | ruler | find | font}]

       pbpaste [-help] [-pboard {general | ruler | find | font}] [-Prefer {txt | rtf | ps}]

       pbcopy takes the standard input and places it in the specified pasteboard. If no pasteboard is speci-fied, specified,
       fied, the general pasteboard will be used by default.  The input is placed in the pasteboard as plain
       text data unless it begins with the Encapsulated PostScript (EPS) file header or the Rich Text Format
       (RTF) file header, in which case it is placed in the pasteboard as one of those data types.

       pbpaste removes the data from the pasteboard and writes it to the standard output.  It normally looks
       first  for plain text data in the pasteboard and writes that to the standard output; if no plain text
       data is in the pasteboard it looks for Encapsulated PostScript; if no EPS is  present  it  looks  for
       Rich Text.  If none of those types is present in the pasteboard, pbpaste produces no output.

       * Encoding:

       pbcopy  and  pbpaste  use locale environment variables to determine the encoding to be used for input
       and  output.   For  example,  absent  other  locale  settings,  setting  the   environment   variable
       LANG=en_US.UTF-8  will  cause  pbcopy  and pbpaste to use UTF-8 for input and output.  If an encoding
       cannot be determined from the locale, the standard C encoding will be used.  Use of UTF-8  is  recom-mended. recommended.
       mended.  Note that by default the Terminal application uses the UTF-8 encoding and automatically sets
       the appropriate locale environment variable.

       -pboard {general | ruler | find | font}
              specifies which pasteboard to copy to or paste from.  If no pasteboard is given,  the  general
              pasteboard will be used by default.

       -Prefer {txt | rtf | ps}
              tells pbpaste what type of data to look for in the pasteboard first.  As stated above, pbpaste
              normally looks first for plain text data; however, by  specifying  -Prefer  ps  you  can  tell
              pbpaste  to look first for Encapsulated PostScript.  If you specify -Prefer rtf, pbpaste looks
              first for Rich Text format.  In any case, pbpaste looks for the other formats if the preferred
              one  is  not  found.   The txt option replaces the deprecated ascii option, which continues to
              function as before.  Both indicate a preference for plain text.

       ADC Reference Library:
       Cocoa > Interapplication Communication > Copying and Pasting
       Carbon > Interapplication Communication > Pasteboard Manager Programming Guide
       Carbon > Interapplication Communication > Pasteboard Manager Reference

       There is no way to tell pbpaste to get only a specified data type.

Apple Computer, Inc.                          January 12, 2005                                     PBCOPY(1)

Reporting Problems

The way to report a problem with this manual page depends on the type of problem:

Content errors
Report errors in the content of this documentation with the feedback links below.
Bug reports
Report bugs in the functionality of the described tool or API through Bug Reporter.
Formatting problems
Report formatting mistakes in the online version of these pages with the feedback links below.