Copy a file directly to the macOS clipboard
Build a paste-ready command, then review its compatibility and effects before running it.
Complete required fields to copy the generated command.
read-onlyno known side effects Compatibility
macOSVerified for macOS using zsh, bash syntax.
Operational knowledgereview due 2027-01-19
Requirementspbcopypbcopy must be installed and available on PATH.
Version supportpbcopy Current supported releasesVerified for macos using zsh, bash syntax; consult compatibility notes for platform-specific differences.
Expected signals(no output on success)Representative successful output; values vary with the selected target and system state.
Known errorspbcopy: command not foundpbcopy is missing or is not available on PATH.
Verifypbcopy < {{file}}The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01pbcopyClipboard writerReads standard input into the macOS pasteboard.
02<Input redirectionFeeds the contents of the following file into pbcopy.
03file.txtSource fileReplace this with the file whose contents you want to copy.
Example input
pbcopy < release-notes.txt
Example output
(no output on success)
The file contents are now on the clipboard.
Illustrative output — exact values vary by system and data.
Official sources