LoginSignup
1
1

More than 5 years have passed since last update.

iTerm2 / zsh 環境でプロンプト上に謎の ^ @(NULL文字)が表示される問題を解決する

Last updated at Posted at 2018-08-07

TL;DR

パッチ済みの Powerline フォントをインストールすれば、謎の ^@(NULL文字)問題は解決する
~/.ssh/config に TCPKeepAlive を設定する

発生状況

iTerm 2 の zsh 環境で、Keep-Alive(Heart Beat)設定を ASCII code 0 (null) にすると、プロンプト上に謎の^@文字が表示される。

パッチ済みの Powerline font のインストール

# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts

iTerm2 の設定

iTerm > Preferences > Profiles > Session を選択、
When idle, send ASCII code 0 every 60 seconds にして、
先頭のチェックボックスをオンにする

iTerm > Preferences > Profiles > Text を選択、
Font と Non-ASCII Font を同じパッチ済みフォントで設定する

追記

※画面がチラつく&若干の表示乱れを許容するならパッチ済みフォントは不要かも……

ASCII code 20 (SP) に設定する

iTerm > Preferences > Profiles > Session を選択、
When idle, send ASCII code 20 every 60 seconds にして、
先頭のチェックボックスをオンにする

最終解

iTerm 2 の Keep-Alive 設定を disable にしてから下記の設定を行う
MacのSSHクライアントで接続したサーバから切断されないようにする

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1