---
title: "Xterm: Enable ANSI OSC-52"
url: https://perrotta.dev/2021/12/xterm-enable-ansi-osc-52/
last_updated: 2025-09-05
---


Every modern terminal emulator supports [ANSI OSC-52](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands) out-of-the-box. `xterm` is not one of those[^1].

OSC-52 allows one to copy text into the system clipboard. It's a very handy escape sequence to be used alongside terminal emulators and terminal multiplexers such as tmux/screen.

It's also possible to enable [OSC-52 in vim](https://github.com/ojroques/vim-oscyank#readme), making copy-and-paste a first-class citizen therein.

As mentioned in the intro, most modern applications already support it [out-of-the-box](https://github.com/ojroques/vim-oscyank#readme), as such there's no need to configure them. We would like to configure xterm as well though, because it is widely available in pretty much every Unix out there.

```shell
$ grep -B 1 -i allowWindowOps ~/.Xresources
! osc-52 support
*.allowWindowOps: true
```

Then apply:

```shell
$ xrdb -merge ~/.Xresources
```

All new xterm applications should then pick up the new resource.

[^1]: maybe because it's not modern, and it's not decent? ;)

