Search code examples
rustzshiterm2rustup

Why is my rust shell output littered with format characters?


When I use rust commands rustup or cargo my output is littered with what appear to be output format markup characters: $<2>

$<2>info: $<2>syncing channel updates for 'stable-x86_64-apple-darwin'
$<2>info: $<2>latest update on 2023-02-09, rust version 1.67.1 (d5a82bbd2 2023-02-07)
$<2>info: $<2>downloading component 'cargo'
$<2>info: $<2>downloading component 'clippy'
$<2>info: $<2>downloading component 'rust-docs'
 19.4 MiB /  19.4 MiB (100 %)   8.8 MiB/s in  2s ETA:  0s
$<2>info: $<2>downloading component 'rust-std'
 27.9 MiB /  27.9 MiB (100 %)   9.1 MiB/s in  3s ETA:  0s
$<2>info: $<2>downloading component 'rustc'
 56.6 MiB /  56.6 MiB (100 %)   9.5 MiB/s in  6s ETA:  0s
$<2>info: $<2>downloading component 'rustfmt'
$<2>info: $<2>installing component 'cargo'
$<2>info: $<2>installing component 'clippy'
$<2>info: $<2>installing component 'rust-docs'
 19.4 MiB /  19.4 MiB (100 %)   3.7 MiB/s in  3s ETA:  0s
$<2>info: $<2>installing component 'rust-std'
 27.9 MiB /  27.9 MiB (100 %)  14.4 MiB/s in  1s ETA:  0s
$<2>info: $<2>installing component 'rustc'
 56.6 MiB /  56.6 MiB (100 %)  17.4 MiB/s in

I am on zsh on iterm2

on Darwin kevs-mbp-3.lan 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101 arm64

Why ?

Update:

% echo $TERM
vt100
% echo $COLORTERM
truecolor

Solution

  • Was able to reproduce this by changing my emulation mode from xterm-256color to vt100.

    In iterm2, under Preferences > Profiles > Terminal, update Report terminal type from vt100 to xterm-256color. You will have to open a new terminal for this to take effect.

    Difference between vt100 and xterm-256colour