devAlice
← Mac

Mac ターミナル — iTerm2 vs WezTerm vs Ghostty+zsh+Starship

デフォルトの Terminal.app に代わる 3 つの選択肢と、最も安定した zsh+Starship 環境を最短で構築する方法。

macOS 組み込みの Terminal.app は動くが、ペイン分割・検索・レンダリング・設定のカスタマイズ性では代替ターミナルに及ばない。このガイドでは iTerm2・WezTerm・Ghostty を比較し、最も安定した環境(WezTerm+zsh+Starship+4 つのモジュール)を最短で構築する方法を説明する。ターミナルの選択は見た目の問題ではなく、毎日の操作効率に直接影響する投資だと考える — 以前は「どれでも動けば同じ」と思っていたが、いまでは設定をコードとして管理できるツールが長期的に優位だとわかっている。

TL;DR

選択肢強み弱み向いているユーザー
WezTerm(推奨)Lua 設定 / GPU アクセラレーション / クロスプラットフォームLua の学習コスト設定をコードとして管理したいソロ開発者
iTerm2最も成熟 / 強力な検索・分割・セッション設定 GUI が複雑機能の豊富さを優先する人
Ghostty高速 / シンプル / 1.0 安定新しい、一部機能が未実装ミニマリスト / 最新志向

1. 選択肢の比較

iTerm2

macOS 専用の最古のターミナル。分割(⌘D)、インスタントリプレイ、検索、トリガー(テキストマッチアクション)、セッション自動復元 — 豊富な機能セット。

WezTerm

Rust 製、Lua で設定、GPU アクセラレーション、クロスプラットフォーム(Mac/Linux/Win)。キーバインディング、テーマ、多重化 — すべて 1 つの Lua ファイルで。再現性が高い。

Ghostty

2024 年に 1.0 安定版リリース。高速、GPU アクセラレーション、最小限の設定。iTerm2/WezTerm より機能は少ないが日常使用には十分。

推奨: WezTerm

「設定をコードとして管理し、新しいマシンで一発復元」するシナリオでは WezTerm が圧倒的に優れている。dotfiles 管理 とも自然に統合できる。このガイドは WezTerm ベースで進める。

2. WezTerm をインストール

brew install --cask wezterm

初回起動 → デフォルトシェルは zsh(macOS のデフォルト)。画面が描画されれば OK。

3. WezTerm 設定 — ~/.config/wezterm/wezterm.lua

mkdir -p ~/.config/wezterm && nvim ~/.config/wezterm/wezterm.lua

local wezterm = require 'wezterm'
local config = wezterm.config_builder()
 
-- フォント
config.font = wezterm.font_with_fallback({
  'JetBrainsMono Nerd Font',
  'Hiragino Sans',  -- 日本語フォールバック
})
config.font_size = 13.0
 
-- カラースキーム
config.color_scheme = 'Catppuccin Mocha'  -- または 'Tokyo Night', 'Dracula'
 
-- ウィンドウ
config.window_decorations = 'RESIZE'  -- タイトルバーを非表示、サイズ変更可能
config.window_padding = { left = 8, right = 8, top = 8, bottom = 8 }
config.window_background_opacity = 0.95
config.macos_window_background_blur = 20
 
-- タブ
config.use_fancy_tab_bar = false
config.tab_bar_at_bottom = true
config.hide_tab_bar_if_only_one_tab = true
 
-- シェル
config.default_prog = { '/opt/homebrew/bin/zsh', '-l' }  -- brew の zsh(macOS デフォルトより新しい)
 
-- キーバインディング
config.keys = {
  -- 分割
  { key = 'd', mods = 'CMD', action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' } },
  { key = 'D', mods = 'CMD|SHIFT', action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' } },
  -- ペインのナビゲーション
  { key = 'LeftArrow', mods = 'CMD|OPT', action = wezterm.action.ActivatePaneDirection 'Left' },
  { key = 'RightArrow', mods = 'CMD|OPT', action = wezterm.action.ActivatePaneDirection 'Right' },
  { key = 'UpArrow', mods = 'CMD|OPT', action = wezterm.action.ActivatePaneDirection 'Up' },
  { key = 'DownArrow', mods = 'CMD|OPT', action = wezterm.action.ActivatePaneDirection 'Down' },
  -- ペインを閉じる
  { key = 'w', mods = 'CMD', action = wezterm.action.CloseCurrentPane { confirm = true } },
}
 
return config

WezTerm は設定ファイル保存時に自動リロードする。⌘D でペイン分割が動作することを確認しよう。

4. zsh をアップグレード

macOS 付属の zsh はやや古い。Homebrew でより新しいバージョンをインストールできる:

brew install zsh
which -a zsh
# /opt/homebrew/bin/zsh
# /bin/zsh
 
# デフォルトシェルを変更
sudo sh -c "echo /opt/homebrew/bin/zsh >> /etc/shells"
chsh -s /opt/homebrew/bin/zsh

新しいターミナル → echo $ZSH_VERSION → 5.9 以降であれば確認完了。

5. Starship プロンプト

oh-my-zsh より軽量で高速。Rust 製の単一バイナリだ:

brew install starship

~/.zshrc の末尾に追記:

eval "$(starship init zsh)"

~/.config/starship.toml

# 素早い起動のデフォルト設定
add_newline = true
format = """
$directory\
$git_branch\
$git_status\
$nodejs\
$python\
$rust\
$cmd_duration\
$line_break\
$character"""
 
[directory]
truncation_length = 3
truncate_to_repo = true
 
[git_status]
disabled = false
ahead = "↑${count} "
behind = "↓${count} "
 
[cmd_duration]
min_time = 2000  # 2秒以上のコマンドのみ表示
 
[character]
success_symbol = "[➜](bold green)"
error_symbol = "[➜](bold red)"

. ~/.zshrc でリロードするか、新しいターミナルウィンドウを開く。

6. 4 つの zsh モジュール

6.1 zsh-autosuggestions

履歴ベースのグレーサジェスション:

brew install zsh-autosuggestions

~/.zshrc

source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh

で承認。

6.2 zsh-syntax-highlighting

コマンドに色をつける(無効なコマンドは赤):

brew install zsh-syntax-highlighting
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

⚠️ syntax-highlighting は .zshrc最後に source すること。

6.3 fzf — ファジーファインダー

brew install fzf
$(brew --prefix)/opt/fzf/install
# すべてのプロンプトに yes

新しいターミナルで:

  • Ctrl+R — 履歴検索
  • Ctrl+T — ファイル検索
  • Alt+C — ディレクトリジャンプ

6.4 zoxide — スマートな cd

brew install zoxide

~/.zshrc

eval "$(zoxide init zsh)"
z proj        # 頻繁に訪れたプロジェクトパスにジャンプ
zi            # インタラクティブピッカー

7. 完全な .zshrc

# 履歴
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt SHARE_HISTORY HIST_IGNORE_DUPS HIST_IGNORE_SPACE
 
# 補完
autoload -Uz compinit && compinit
 
# Brew
eval "$(/opt/homebrew/bin/brew shellenv)"
 
# モジュール
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
eval "$(zoxide init zsh)"
 
# エイリアス
alias ll='ls -lah'
alias gs='git status -sb'
alias gd='git diff'
alias ..='cd ..'
 
# ツール
eval "$(starship init zsh)"
 
# (最後に置くこと)
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

8. iTerm2 のクイックセットアップ(代替)

WezTerm の代わりに iTerm2 を好む場合:

brew install --cask iterm2
  • Preferences → Profiles → Default → Text → フォント = JetBrainsMono Nerd Font 13pt
  • Window → 透明度 5%、ブラー ON
  • Keys → Hotkey window — ⌥ Space のようなグローバルショートカットをバインド

iTerm2 の目玉機能は Hotkey Window(どこからでもフローティングターミナルをトグルできる)。WezTerm でも同様の設定が可能だが、iTerm2 はすぐに使える状態だ。

確認

  1. 新しいターミナル → Starship プロンプトが表示される(色付きの cwd / git ブランチ)
  2. Ctrl+R → fzf インタラクティブ履歴検索
  3. ls → zsh-syntax-highlighting がコマンドに色をつける
  4. 過去のコマンドの一部を入力 → グレーのオートサジェスション → で承認
  5. z proj → 以前に訪れたプロジェクトフォルダにジャンプ
  6. WezTerm で ⌘D → ペインを分割 → ⌘⌥← でナビゲート

トラブルシューティング

syntax-highlighting が色を表示しない

  • .zshrc最後に source されていない(他のモジュールの後でなければならない)
  • WezTerm のカラースキームが 256 色未満 — 可能性は低いが、Catppuccin / Tokyo Night を優先する

Starship のグリフが文字化けする

Nerd Font が欠けている。WezTerm のフォント設定を確認し、フォントを実際にインストールする(brew install --cask font-jetbrains-mono-nerd-font)。

z が何もしない

  • .zshrc に zoxide init がない、または .zshrc がリロードされていない
  • 最初はデータベースが空 — 数回 cd してから学習させる

WezTerm がデフォルトで $HOME を開く

設定で config.default_cwd = wezterm.home_dir .. '/work' と指定するか、フォルダへの cd をエイリアスにする。

chsh がシェルを変更しない

  • 新しいシェルが /etc/shells に追加されていない → chsh が失敗する
  • ログアウト・ログインするか、再起動する

参考リンク

更新履歴

  • 2026-05-12: 初稿。3 つのターミナル比較+WezTerm+zsh+Starship+4 つのモジュール+5 つのトラブルシューティングケース。