---
category: 'computing'
date: 2026-09-27 22:29:12 UTC-05:00
description: >
    The command-line tool for writing to the MacOS clipboard is `pbcopy`.
link: ''
slug: a-clipboard-roundup
tags: >
    clipboard, commandline, macos, linux, windows, wayland, emacs,
title: 'a clipboard roundup'
type: text
---

To write to the system clipboard from the command line, you can pipe
to the standard input of a program.  But the name of that program is
different on different operating systems, because honestly so is
everything.

  + Windows
  : `clip.exe`
  * MacOS
  : `pbcopy`
  * ChromeOS
  : `wl-copy`, from the package `wl-clipboard`.  This might work on
    other Unixy systems using [Weyland][2] for interprocess stuff.
  * Linux / XWindows
  : It [looks like][1] `xclip` or `xsel`.  It's weird not to have a
    Linux computer handy anywhere.

  [1]: https://stackoverflow.com/a/750466/1650379
  [2]: https://en.wikipedia.org/wiki/Wayland_(protocol)

So an Emacs person would do `M-| pbcopy` to send the current region to
the clipboard.

<!-- TEASER_END -->

The [Stack Overflow thread linked above][1] has lots of links and discussions.

Previous clipboard stuff:

  * {{% doc %}}the-clipboard{{% /doc %}}
  * {{% doc %}}clipping-chrome{{% /doc %}}
