Skip to content

Support additional OSC 52 clipboard types#1104

Open
mgulick wants to merge 2 commits into
mobile-shell:masterfrom
mgulick:osc-52-clipboard-types
Open

Support additional OSC 52 clipboard types#1104
mgulick wants to merge 2 commits into
mobile-shell:masterfrom
mgulick:osc-52-clipboard-types

Conversation

@mgulick

@mgulick mgulick commented Jul 16, 2020

Copy link
Copy Markdown

Fixes #967.
Fixes #1090.
Fixes #637.

NOTE: This pull request is similar to #1054, but improves it by preserving the selection buffer into which to place the copied text. #1054 always places the copied text into CLIPBOARD, but this preserves the OSC 52 parameter so that the copied text may go into CLIPBOARD, PRIMARY, SECONDARY, or one of the cut buffers. This matches the behavior of ssh and plain XTerm.

The OSC 52 escape sequence supports specifying which X selection buffer to place the selection into. The protocol format is:

\033]52;C;D\007

The C parameter determines the selection buffer. It consists of zero or more of the following characters:

c: CLIPBOARD
p: PRIMARY
q: SECONDARY
s: XTerm-selected (based on XTerm.vt100.selectToClipboard)
0-7: Numbered cut buffer

The default if left blank is 's0', representing the configurable primary/clipboard selection and cut buffer 0. [1]

D is the base64 encoded text to place in the selection buffer.

This patch modifies the transferred clipboard data to include both the selection parameter and the base64 text. I.e. previously the
transferred clipboard data only contained 'D', and now it contains 'C;D'.

To test this functionality:

  1. Open XTerm
  2. Ctrl-Right Click and select 'Allow Window Ops'
  3. Connect to a server w/ mosh
  4. Run the following in the remote connection:
    $ printf "\033]52;c;$(echo test1234 | base64)\007"
    $ printf "\033]52;p;$(echo test2345 | base64)\007"
    $ printf "\033]52;q;$(echo test3456 | base64)\007"
  5. Open another terminal on the local machine and run:
    $ xclip -o -selection clipboard
    test1234
    $ xclip -o -selection primary
    test2345
    $ xclip -o -selection secondary
    test3456
    
  6. You can also try:
    $ printf "\033]52;;$(echo testdefault | base64)\007"
    (This should update either the clipboard or primary selection based on the Xterm settings)
  7. To test the cut buffers you can use the same procedure, substituting the cut buffer number in C, and then use xcutsel to transfer the data from the cut buffer to the PRIMARY selection, where it can then be viewed with xclip.

Note, I observed that XTerm does not currently (as of XTerm patch 358) support specifying more than one value in C. The specification does support it, and this appears to just be a simple bug in XTerm (a patch has been submitted to the maintainer to fix it).

[1] https://github.com/ThomasDickey/xterm-snapshots/blob/master/ctlseqs.txt

This PR also adds a clipboard sequence number to allow duplicate copied text to update the client's clipboard.

@mgulick mgulick marked this pull request as ready for review July 16, 2020 03:06
@mgulick mgulick force-pushed the osc-52-clipboard-types branch from 008c27c to 1586486 Compare July 23, 2020 01:37
@mgulick

mgulick commented Jul 23, 2020

Copy link
Copy Markdown
Author

Added a new commit which fixes issue #1090. I believe this PR now addresses all outstanding issues in #637.

@mgulick mgulick force-pushed the osc-52-clipboard-types branch from 1586486 to e922128 Compare July 23, 2020 01:41
@3gx

3gx commented Aug 31, 2020

Copy link
Copy Markdown

will it be merged? this MR works fine on my Linux server & Mac client.

@gwicke

gwicke commented Sep 28, 2020

Copy link
Copy Markdown

Seems to work okay with tmux copy mode. If you are migrating from #1054, then make sure to rebuild both client & server from this PR, since the wire format changed.

@mgulick

mgulick commented Sep 29, 2020

Copy link
Copy Markdown
Author

Seems to work okay with tmux copy mode. If you are migrating from #1054, then make sure to rebuild both client & server from this PR, since the wire format changed.

That is true about the wire format. I believe it is incompatible with the current wire format used by the master branch. I don't quite grok the wire format used by mosh and haven't been able to figure out where in the code fields used by the framebuffer get turned into bits sent on the wire. Since there hasn't been an official mosh release since clipboard support was added, I don't believe it causes any compatibility issues with previous releases. If it does introduce incompatibility, then I believe the original commit adding clipboard support would also have introduced the same sort of incompatibility issues.

If this wire format compatibility is a concern, it might be possible to make this backwards compatible, but I might need some help understanding the wire format a little more.

@JonathanWheeler

JonathanWheeler commented Oct 17, 2020

Copy link
Copy Markdown

Confirming this fixes all remaining clipboard issues for me on a local client running macOS Catalina v10.15.6 + iTerm2 v3.3.12 + mosh v1.3.2 [build mosh-1.3.2-92-ge922128 using: git clone https://github.com/mobile-shell/mosh && cd mosh && gh pr checkout 1104 && ./autogen.sh && ./configure && make && sudo make install] to a remote Ubuntu 20.04.1 LTS server running mosh v1.3.2 [ditto as before] + tmux v3.2. Works with both copy-mode-vi key bindings and simple mouse selection. It even works with remote (and local) vim sessions when combined with @sunaku's post at https://sunaku.github.io/tmux-yank-osc52.html.

It's taken over ten years to get to this point; the holy grail has finally been achieved!!! Well done, @mgulick!!

@LubosRemplik

Copy link
Copy Markdown

+1 to merge

@arg

arg commented May 6, 2021

Copy link
Copy Markdown

I hope I'm wrong but this project looks dead. Most recent release: ~4 years ago. Most recent commit to master: 1 year ago. No maintainers activity for several months. Would be great if @keithw and @cgull could check this indeed useful PR and make it merged (not even mentioning the new release).

@xPMo

xPMo commented Aug 4, 2021

Copy link
Copy Markdown

I hope I'm wrong but this project looks dead. Most recent release: ~4 years ago. Most recent commit to master: 1 year ago. No maintainers activity for several months.

I saw from other issues that there were a couple of blockers to a new release. Creating a pinned issue and a milestone for the next release would help communicate this. (This is offtopic to this PR though)

@catskul

catskul commented Nov 24, 2021

Copy link
Copy Markdown

@eminence any chance you might have some time to get eyes on this?

Also, it seems like you might be the only active maintainer right now, any chance of getting another to help chew through the PR and issue backlog? Perhaps @agriffis or @njaard ?

@scjones-attunely

Copy link
Copy Markdown

@eminence another ping - would be great to have this/ and sounds like you have offers for more help to support mosh.

@ezzieyguywuf

Copy link
Copy Markdown
Contributor

Can anyone familiar with this PR see if 4b240ac resolves the same issues noted in the first message?

@mgulick

mgulick commented Feb 8, 2022

Copy link
Copy Markdown
Author

Can anyone familiar with this PR see if 4b240ac resolves the same issues noted in the first message?

No, this PR builds on that commit to add some additional functionality that is missing.

@delbao

delbao commented Apr 16, 2022

Copy link
Copy Markdown

This almost works. But I cannot make it work in one scenario

What worked
in mosh + tmux

esc="\033]52;c;$(printf %s "blabla" | base64)\a"
esc="\033Ptmux;\033$esc\033\\" # again for tmux!
printf "$esc"

successfully remote copy to local clipboard.

But if I put this in ~/.tmux.conf.

bind-key -T copy-mode-vi Y send-keys -X copy-pipe '~/bin/yank > #{pane_tty}'

(~/bin/yank is copied from this well-known script: https://sunaku.github.io/tmux-yank-osc52.html). However, in a ssh session, this works without any issue.

I tweaked it further.

bind-key -T copy-mode-vi Y send-keys -X copy-pipe '~/bin/yank > ~/test.out'

then in another window, if I cat ~/test.out. Surprisingly, the copied text was sent to local clipboard.

I dont know what the root cause here. but hunch is related to tmux's pane_tty.

@sunaku

sunaku commented Apr 17, 2022

Copy link
Copy Markdown

Hi @delbao, what happens if you change the yank > #{pane_tty} redirection to yank > $SSH_TTY instead? 🤔 And which version of tmux are you using?

@delbao

delbao commented Apr 17, 2022

Copy link
Copy Markdown

Hi @delbao, what happens if you change the yank > #{pane_tty} redirection to yank > $SSH_TTY instead? 🤔 And which version of tmux are you using?

Tried SSH_TTY, nothing changed. This issue is specific to this patch of mosh. SSH works fine.

$ tmux -V
tmux 3.2a

@andrewmzhang

andrewmzhang commented Apr 22, 2022

Copy link
Copy Markdown

@delbao
This patch works fine on my machine for your use case: mosh + tmux + tmux-copy-paste.

Here is a copy of my ~/.tmux.conf

# sets tmux to use OSC 52 escape
set -g set-clipboard on
setw -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection

# OSC 52 haxor. I don't think you need this line, but try it if the above doesn't work.
# set -ag terminal-overrides "vte*:XT:Ms=\\E]52;c;%p2%s\\7,xterm*:XT:Ms=\\E]52;c;%p2%s\\7"

(disclaimer: the following info may be out of date) Older(?) tmux needs the last line because:

Tmux supports OSC 52 but does not pass the “c;” option, according to yudai’s post. However we can force it to pass the “c;” option.

@delbao

delbao commented Apr 24, 2022

Copy link
Copy Markdown

@delbao This patch works fine on my machine for your use case: mosh + tmux + tmux-copy-paste.

Here is a copy of my ~/.tmux.conf

# sets tmux to use OSC 52 escape
set -g set-clipboard on
setw -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection

# OSC 52 haxor. I don't think you need this line, but try it if the above doesn't work.
# set -ag terminal-overrides "vte*:XT:Ms=\\E]52;c;%p2%s\\7,xterm*:XT:Ms=\\E]52;c;%p2%s\\7"

(disclaimer: the following info may be out of date) Older(?) tmux needs the last line because:

Tmux supports OSC 52 but does not pass the “c;” option, according to yudai’s post. However we can force it to pass the “c;” option.

thanks for the help. However, sunaku's script already did what you described. it doesn't work for Mosh with this patch.

@xero

xero commented Apr 28, 2023

Copy link
Copy Markdown

bumping this thread b/c this pr saved me hours of time. working flawlessly on a debian vps connected from my ipad using blink shell in zsh, tmux, and neovim using osc52 tooling

jdrouhard added a commit to jdrouhard/mosh that referenced this pull request May 20, 2023
@kkonevets

kkonevets commented Aug 19, 2023

Copy link
Copy Markdown

I have applied the patch but when copying to clipboard in emacs I get this error

clipetty-cut: Opening output file: Permission denied, /dev/pts/1

But it can be fixed if I start emacs like so

unset SSH_TTY; emacs

Anyway, thanks for this PR, it works now but not out of the box.

@markx

markx commented Jan 4, 2024

Copy link
Copy Markdown

Scrolled through this thread but failed to figure out: Is there any good reason why this was not merged?

If this repo is abandoned, is there another more actively-maintained fork?

@achernya

achernya commented Jan 4, 2024

Copy link
Copy Markdown
Collaborator

Hi,

This PR hasn't been merged for two reasons:

  1. The maintainers haven't gotten to it yet. Merging a PR isn't as sttaight-forward as clicking the merge button; we have to ensure that the code does what is intended and the PR meets our standards for inclusion and do a complete code review. Like most folks here, the maintainers don't work on mosh full-time, but rather as volunteers in their spare time.
  2. There are merge conflicts, which increase the workload of (1), above.

Just because there are PRs open doesn't mean the repository is abandoned.

@markx

markx commented Jan 6, 2024

Copy link
Copy Markdown

I absolutely respect maintainers' right to handle any PRs in any way. Glad to know there's no technical reason against this PR so far.

OSC 52 is not working for me (and many others I believe), and this is the only blocker for me to use mosh. I hope maintainers consider prioritizing this PR. After all it's a relatively small code change for such an important feature.

To be fair, the second reason doesn't stand to me - the merge conflicts are more of a consequence, not reason, of that this PR hasn't been got to for 3+ years.

@mgulick

mgulick commented Jan 6, 2024

Copy link
Copy Markdown
Author

I just rebased these patches onto master. There were no "real" conflicts, just some indentation changes. I built these changes again and did a quick test to confirm they still appear to be working. I've been using these patches in my daily workflow for a few years, albeit on an older mosh version based on the original PR patch series.

The XTerm bug mentioned at the end of the PR description has been fixed as of xterm version 359.

I did a quick test using this patched mosh and an unpatched server. While clipboard syncing does not work (to be expected), mosh itself appears to function normally, so maybe there are no backwards-compatibility issues with this change.

@joaotavora

Copy link
Copy Markdown

I'd like to try out this PR, but I cannot easily compile the client. I can easily compile the server, though. Is that enough?

@mgulick

mgulick commented Feb 3, 2024

Copy link
Copy Markdown
Author

@joaotavora both the client and server need this change, however you don't need to install them in the usual locations. As long as you have the mosh-client binary with this patch somewhere on the client, and the mosh-server binary with this patch somewhere on the server, you can connect using a command like:

mosh --client=/home/client/mosh-client --server=/home/server/mosh-server server

This does not require updating the mosh command on the client. The mosh command is just a perl script that coordinates setting up the connection, and isn't affected by this patch. In my case, I'm successful even with an old version of mosh, such as mosh 1.3.2 on Debian 11.

@joaotavora

Copy link
Copy Markdown

Thanks @mgulick. Though somehow, compiling just the server worked. at least for very limited testing. I was able to copy to the clipboard from Emacs and paste in my host's browser. I can see the client binary linking in the terminal subsystem though, but I don't know enough of the architecture to understand why that is or why my test worked.

@mgulick

mgulick commented Feb 4, 2024

Copy link
Copy Markdown
Author

@joaotavora I think on recent mosh releases, standard clipboard copying will work without this patch. I'm able to do the standard clipboard updates going from a 1.4.0 client to a 1.4.0 server without this patch. However the other issues, such as primary, secondary, and cutbuffer support, as well as the issue with duplicate clipboard updates not getting properly synchronized (#1090), will still exist.

@joaotavora

Copy link
Copy Markdown

Thanks, could have sworn it didn't work before I compiled and installed your version though, maybe I misdiagnosed 👍

@xero

xero commented Feb 4, 2024

Copy link
Copy Markdown

so i've been using the older version of this patch for a long time with no issues beyond when copying higher level unicode and emojis. strings like this would not be correctly copied to the clipboard instead replaced with a placeholder for each character.

гєŦ๏г๓คՇ Շђє קɭคภєՇ 💾

@markx

markx commented Feb 28, 2024

Copy link
Copy Markdown

@ezzieyguywuf If you have permission to merge, PTAL

@AkechiShiro

Copy link
Copy Markdown

@achernya any news on this PR merge possibility ??

@3ynm

3ynm commented Jun 12, 2024

Copy link
Copy Markdown

@mgulick Clipboard does not work for me when using mosh 1.4.0 on both client and server. It works with SSH.

Perhaps something relevant about this, is that I'm using it on a fairly old CentOS 7 server.

@mgulick

mgulick commented May 12, 2025

Copy link
Copy Markdown
Author

It doesn't look like mosh has much activity in terms of commits these days, but I'm still interested in getting this PR merged if there is an opportunity to do so. It would be great to be able to eventually have this upstreamed and in distros so that I can stop building a custom mosh on every system that I access.

@isker

isker commented May 12, 2025

Copy link
Copy Markdown

FWIW I have run @jdrouhard's fork https://github.com/jdrouhard/mosh/tree/patched containing this PR and some others for over a year. Thanks to everyone that has produced these fixes. Community in action 🌞.

@rnk

rnk commented Mar 4, 2026

Copy link
Copy Markdown

It doesn't look like mosh has much activity in terms of commits these days, but I'm still interested in getting this PR merged if there is an opportunity to do so.

There is recent activity from maintainers, so I hope they can take another look at this. They aren't listed as assigned reviewers, so I'm not sure they get pings. Speaking for myself, when acting as a maintainer, it's easy for these much-requested PRs to fly under the radar, so pinging @achernya @vapier @eminence

I applied the predecessor PR locally and confirmed it made things work and I was preparing to rebase and submit a new PR, but I hadn't dug up any actual material on how the OSC protocol is supposed to work to really understand why these changes (ignoring 'c' options and skipping to the next ';') are correct.

@rnk

rnk commented Mar 4, 2026

Copy link
Copy Markdown

I hadn't dug up any actual material on how the OSC protocol is supposed to work to really understand why these changes (ignoring 'c' options and skipping to the next ';') are correct.

I've actually reviewed the PR code, pull request message, referenced the original archived xterm plain text docs (helpfully linked in the PR) , and the ghostty docs on OSC 52, which are more readable and modern.

I think there's no wire protocol backwards compatibility concern. I tried to dig into how the clipboard gets serialized, but and it looks like the OSC string goes directly over the wire, so if we have an old client with a non 'c' clipboard identifier, it will just get dropped, but that's what would happen anyway. At least, an LLM agrees with this analysis, but they tend to use motivated reasoning.

Regarding testing, I used an LLM to add tests using the existing testing conventions and pushed them in this commit. I confirm the tests pass after and fail before these source changes as expected, and the error messages are useful. If that's a blocking concern, feel free to merge those changes into this PR.

@mgulick

mgulick commented Mar 4, 2026

Copy link
Copy Markdown
Author

If there is renewed interest from a maintainer on getting this merged, I'm happy to help with whatever is necessary as well.

@vapier

vapier commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

i'm not a maintainer, just a rando who got lucky and had some fixes merged

gfanton added a commit to gfanton/nixpkgs that referenced this pull request Mar 9, 2026
Stock mosh 1.4.0 drops OSC 52 sequences from tmux because it doesn't
handle the selection buffer parameter. Use jdrouhard's fork which
includes the fix from PR #1104 (mobile-shell/mosh#1104).

This enables tmux copy-paste through mosh to reach the local clipboard
via Ghostty's OSC 52 support.
owen1025 pushed a commit to owen1025/dotfiles that referenced this pull request Apr 23, 2026
Under tmux 3.6a + mosh 1.4.0, both the set-clipboard built-in and DCS
passthrough via #{pane_tty} fail — tmux writes OSC 52 to its own
controlling pty, which is the mosh-server's *internal* pty, not the
outer pty mosh forwards to the client. Result: copy-mode y never
updated the macOS clipboard when attached over mosh.

tmux-osc52-copy now resolves the most-recently-active #{client_tty}
for the pane's session and writes raw OSC 52 directly there, bypassing
tmux entirely. That pty is owned by mosh-server and reaches Ghostty.

Also: allow-passthrough all → on (OSC 52 path no longer uses DCS
passthrough; 'on' still covers OSC 11 bg-color query for TUIs).

Verified: writing OSC 52 to /dev/ttysXXX (client_tty) reaches the
client pasteboard; writing to #{pane_tty} does not.

Ref: mobile-shell/mosh#1104 (delbao, 2022)

Constraint: stock Homebrew mosh 1.4.0 + tmux 3.6a — no custom builds
Rejected: mosh PR #1104 patched build | adds non-stock package maintenance
Rejected: pane-stdout write via cat trick | run-shell -b has no TTY
Confidence: high
Scope-risk: narrow
Directive: tmux-osc52-copy MUST scope client lookup to current pane's session; cross-session write would clobber another client's clipboard
Not-tested: multi-user tmux server where target_tty belongs to another user (guarded by [ -w "\$tty" ] silent-skip)
malloc47 added a commit to malloc47/config that referenced this pull request May 6, 2026
Picks up mobile-shell/mosh#1104 to fix tmux→mosh→Ghostty clipboard
forwarding without the tmux-side copy-pipe workaround. Applied to both
the user mosh client (config/home.nix) and the mosh-server module
(modules/mosh.nix) so the fix lands end-to-end.
harivansh-afk added a commit to harivansh-afk/nix that referenced this pull request May 15, 2026
## Why

On a `local terminal -> mosh -> tmux -> shell` stack, OSC 52 clipboard writes silently disappear. mosh-server 1.4 accepts only the `c` (CLIPBOARD) selector and drops every other variant (PRIMARY, `s0`, empty). tmux's default `Ms` capability passes through whatever selector copy-mode or the inner app picked, so most of the time tmux hands mosh a sequence mosh refuses to relay.

## What

In `home/tmux.nix`:

- `set -g set-clipboard on` makes tmux relay copy events via the `Ms` terminfo capability instead of only storing them in its internal buffer.
- `set -ag terminal-overrides ',*:Ms=\E]52;c;%p2%s\7'` patches `Ms` to always emit `\e]52;c;<base64>\a` regardless of the requested selector, which is the form mosh-server 1.4 accepts.

With both, double-click selection, copy-mode (`prefix [` ... `Enter`), and inner-app OSC 52 emissions (nvim `osc52`, scripts that print the escape) all reach the local Ghostty clipboard.

## Refs

- tmux/tmux#3423 tmux interferes with OSC 52 when running in mosh
- mobile-shell/mosh#1054 broaden accepted OSC 52 selectors
- mobile-shell/mosh#1104 additional clipboard selector types

## Test plan

- nix build .#nixosConfigurations.spark.config.system.build.toplevel built clean on this branch
- The two set-option lines were live-applied to the running tmux server and verified via tmux show-options
- After just switch, restart tmux server and confirm copy persists
- Verify with: printf '\e]52;c;%s\a' "$(printf hello | base64 -w0)" then paste locally

Reviewed-on: https://git.harivan.sh/harivansh-afk/nix/pulls/78
Co-authored-by: Harivansh Rathi <rathiharivansh@gmail.com>
Co-committed-by: Harivansh Rathi <rathiharivansh@gmail.com>
@mpasternak

Copy link
Copy Markdown

@mgulick thanks for the patch, looks like I could use it too. Does it work with tmux?

@ezzieyguywuf

Copy link
Copy Markdown
Contributor

I'm also happy to help! (also not a maintainer I think)

@mpasternak

Copy link
Copy Markdown

Thanks for this, @mgulick and @ezzieyguywuf — preserving the OSC 52 selection parameter is exactly the behaviour I was after. This works perfectly with tmux. I love it🙏

For anyone who'd like to try the PR before it's merged, here's how to build a working mosh from this branch. The OSC 52 changes live in both mosh-client and mosh-server, so you'll want this build on both ends of your connection.

1. Install build dependencies

macOS (Homebrew):

brew install autoconf automake pkgconf protobuf

(On macOS mosh uses the system CommonCrypto and ncurses, so OpenSSL isn't needed.)

Debian / Ubuntu:

sudo apt-get install autoconf automake pkg-config protobuf-compiler \
  libprotobuf-dev libutempter-dev zlib1g-dev libncurses-dev libssl-dev

2. Get the PR and build it

git clone https://github.com/mobile-shell/mosh.git
cd mosh
git fetch origin pull/1104/head:osc52 && git checkout osc52
./autogen.sh
./configure
make

This produces src/frontend/mosh-client and src/frontend/mosh-server. To put them on your PATH:

sudo make install   # installs to /usr/local by default

3. Use it

mosh user@your-server

mosh runs the client locally and the server on the host you connect into, so install this build on both machines. If you only built the new server on the remote host, you can point an existing local mosh at it with:

mosh --server=/path/to/mosh-server user@your-server

Verified on macOS (Apple Silicon, Homebrew) and the standard autotools flow on Linux. 🎉

macOS: make a binary package you can copy to another Mac (no recompiling)

If you want to build once and copy the result to other Macs, wrap the branch in a tiny local Homebrew formula and bottle it:

brew tap-new "$USER/local"
cat > "$(brew --repository "$USER/local")/Formula/mosh-osc52.rb" <<'RUBY'
class MoshOsc52 < Formula
  desc "mosh with OSC 52 clipboard types (PR #1104)"
  homepage "https://mosh.org"
  url "https://github.com/mgulick/mosh.git", branch: "osc-52-clipboard-types"
  version "1.4.0-osc52"
  license "GPL-3.0-or-later"
  depends_on "autoconf" => :build
  depends_on "automake" => :build
  depends_on "pkgconf"  => :build
  depends_on "protobuf"
  uses_from_macos "ncurses"
  def install
    ENV.append_to_cflags "-DNDEBUG"
    system "./autogen.sh"
    system "./configure", "--prefix=#{prefix}"
    system "make", "install"
  end
end
RUBY

brew install --build-bottle "$USER/local/mosh-osc52"
brew bottle "$USER/local/mosh-osc52"   # emits a relocatable .bottle.tar.gz

Copy that .bottle.tar.gz to the other Mac, add it to the formula's bottle do block (or just brew install the formula there to rebuild). The only runtime dependency is Homebrew protobuf, which brew pulls in automatically.

@ezzieyguywuf

Copy link
Copy Markdown
Contributor

I built and tested this, it seems to work as expected. I can provide a code review too if that will help move this along.

@ezzieyguywuf

Copy link
Copy Markdown
Contributor

@mgulick I rebased this on master (it has some commits a few months ago) and ran the tests. A few are failing:

$ make -j$(nproc) check
<snip>
PASS: ocb-aes
PASS: base64
PASS: encrypt-decrypt
PASS: local.test
PASS: nonce-incr
PASS: emulation-scroll.test
PASS: emulation-back-tab.test
PASS: emulation-80th-column.test
PASS: unicode-combine-fallback-assert.test
PASS: emulation-ascii-iso-8859.test
PASS: emulation-attributes-vt100.test
XFAIL: emulation-attributes-256color8.test
PASS: emulation-attributes-256color248.test
PASS: emulation-attributes-16color.test
PASS: emulation-attributes-truecolor.test
PASS: emulation-attributes-bce.test
PASS: emulation-multiline-scroll.test
XFAIL: e2e-failure.test
PASS: unicode-later-combining.test
PASS: e2e-success.test
PASS: emulation-cursor-motion.test
PASS: emulation-wrap-across-frames.test
PASS: network-no-diff.test
PASS: window-resize.test
PASS: repeat-with-input.test
PASS: prediction-unicode.test
PASS: server-network-timeout.test
PASS: server-signal-timeout.test
PASS: repeat.test
PASS: pty-deadlock.test
============================================================================
Testsuite summary for mosh 1.4.0
============================================================================
# TOTAL: 31
# PASS:  29
# SKIP:  0
# XFAIL: 2
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================

I'm not sure if these are related to your changes or not, but it may be worth looking into

@achernya

achernya commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

XFAIL is "expected to fail and did"

@ezzieyguywuf

Copy link
Copy Markdown
Contributor

XFAIL is "expected to fail and did"

Oh sweet, then everything passes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mosh clipboard issue tmux copy buffer is not transferred to clipboard. mosh does not transmit OSC 52 sequence to client