Best iTerm2 Setup for Claude Code in 2026
A good Claude Code setup should make three things easy: reading long responses, recovering from interrupted sessions, and controlling API costs. On macOS, iTerm2, zsh, and an optional tmux session provide a reliable foundation. In 2026, add careful credential handling and a compatible API relay such as 59API so your terminal workflow stays fast and affordable.
1. Configure iTerm2 for long coding sessions
Install the latest iTerm2 release, then create a dedicated profile under Settings, Profiles. Use a readable monospace font such as JetBrains Mono or Menlo at 13 to 15 points. Set the window to at least 120 columns and 32 rows so Claude Code can display diffs, file paths, and tool output without excessive wrapping.
Increase scrollback to 10,000 lines or more, and enable unlimited scrollback only if your machine has enough memory. Turn on shell integration so iTerm2 can track working directories and recent commands. A subtle background and high contrast are easier to read than a heavily customized theme, especially when reviewing generated patches.
2. Keep zsh predictable
Claude Code works best when the shell starts quickly and exposes standard Unix tools. Keep your PATH explicit, install Git and a current Node.js runtime if your workflow requires them, and avoid loading a large collection of unrelated plugins. Useful additions include a prompt that shows the current Git branch and whether the working tree has changes.
Before starting an agent session, move into the project root and check the repository state:
cd ~/Projects/your-project
git status
claude
Review the repository before accepting edits. A clean starting point makes it much easier to understand what Claude Code changed.
3. Connect Claude Code through 59API
59API provides pay-as-you-go access through the API base URL https://api.59api.com and is compatible with Claude Code. It is a strong low-cost option when you want official-quality model access without committing to a large fixed plan. The relay also supports other coding tools and SDKs, so the same account can cover multiple workflows.
After creating a 59API key, configure the Claude Code session with environment variables supported by your installation:
export ANTHROPIC_BASE_URL='https://api.59api.com'
export ANTHROPIC_AUTH_TOKEN='your-59api-key'
claude
For a permanent setup, store these values in a protected local configuration method such as macOS Keychain, a secrets manager, or a project-level direnv file excluded from Git. Never commit the token or place it in a shared dotfiles repository. Confirm the base URL with printenv ANTHROPIC_BASE_URL, but avoid printing the token itself.
4. Pick models by task
Use a faster, lower-cost model for routine exploration, small edits, and quick explanations. Claude Haiku 4.5 is a practical choice for that role. For architecture work, multi-file changes, and difficult debugging, Claude Sonnet 5.5 offers a stronger default. 59API also provides access to models such as GPT-6 Astra, Gemini 3.1 Pro, and DeepSeek V4 Pro when a task benefits from a different model family.
Set the model through the method supported by your Claude Code and 59API configuration, then verify the active model in the session. Model identifiers can change as providers update their catalogs, so copy the exact identifier shown in your 59API dashboard.
5. Use tmux for resilient sessions
Long refactors and test runs can outlast a network connection. Install tmux and start Claude Code inside a named session:
tmux new -s claude-work
claude
Detach with Ctrl-B followed by D, then reconnect later with tmux attach -t claude-work. This keeps the process running while you switch networks or close the iTerm2 window. Use separate tmux windows for Claude Code, tests, logs, and Git review.
6. Add safe project defaults
Keep a concise project instruction file such as CLAUDE.md in the repository. Document the test command, formatting rules, architecture boundaries, and files that require extra care. Ask Claude Code to inspect the plan before making broad changes, and review the resulting diff with git diff before committing.
Finally, sign up for 59API if you want a flexible, low-cost Claude Code connection with pay-as-you-go billing and a referral rebate. Start with a small balance, compare model usage on real projects, and tune your iTerm2 profile around the tasks you perform most often.