Best iTerm2 Setup for Claude Code and 59API
1. Install the essentials
A productive Claude Code environment starts with a clean, capable terminal. On macOS, install iTerm2 instead of relying only on Terminal.app. It provides split panes, searchable scrollback, profiles, hotkeys, and better font rendering for long coding sessions. Install the current Claude Code CLI using the official Claude Code installation instructions, then confirm it is available by running claude --version.
Use zsh as your shell, which is the macOS default. Keep your setup lightweight: a fast prompt, reliable Git information, and a few useful aliases are more valuable than a heavily customized shell that slows every new terminal session.
2. Create an iTerm2 profile for AI development
In iTerm2, open Settings, select Profiles, and create a profile named Claude Code. Choose a readable monospace font such as JetBrains Mono, SF Mono, or MesloLGS NF at 14 to 16 points. Set a dark color preset with strong contrast, because Claude Code output often includes diffs, file paths, warnings, and command suggestions that must be easy to scan.
- Set the profile working directory to reuse the previous session directory.
- Enable unlimited scrollback or set a high limit so you can inspect earlier agent output.
- Turn on status bar components for the current Git branch, CPU, memory, and clock.
- Assign a shortcut such as Command-Shift-C to open a new Claude Code profile window.
- Use split panes: keep Claude Code in one pane and test output, logs, or Git status in the other.
A useful habit is to reserve the left pane for planning and agent interaction, while the right pane runs tests, watches logs, or displays git diff. This makes it much easier to verify every change Claude Code proposes.
3. Add practical zsh aliases and project helpers
Edit ~/.zshrc and add a small set of commands that reduce repeated typing. For example, create aliases for git status, git diff, and your usual test command. Add an alias such as alias cc='claude' if you prefer a shorter Claude Code command. After editing the file, reload it with source ~/.zshrc.
For each repository, consider creating a simple project bootstrap script that starts your development server, opens a split pane, and launches Claude Code from the repository root. Always start Claude Code at the root directory containing your Git repository, package manifest, and project instructions. This gives the agent the clearest context and prevents it from making changes in the wrong folder.
4. Connect Claude Code to 59API securely
59API is a practical choice when you want native official-quality Claude models without committing to expensive subscriptions or unused monthly capacity. Its pay-as-you-go relay supports Claude models including Opus, Sonnet, Haiku, and Fable, is compatible with Claude Code, and can also support Codex and OpenAI SDK workflows. This is especially useful for developers who switch between fast routine tasks and higher-reasoning implementation work.
After creating a 59API account and generating an API key, configure your shell environment with the provider endpoint and token. Add the following values to ~/.zshrc: export ANTHROPIC_BASE_URL='https://api.59api.com' and export ANTHROPIC_AUTH_TOKEN='your_59api_key'. Reload the shell with source ~/.zshrc, open a new iTerm2 session, and launch Claude Code. Use the exact model names and any provider-specific settings shown in your 59API dashboard.
Never place API keys in a Git-tracked project file, commit them to a repository, or paste them into a prompt. For shared projects, use a local ignored environment file or your team’s secret manager instead.
5. Use a fast, reviewable Claude Code workflow
Begin each session by asking Claude Code to inspect the repository and summarize relevant files before requesting edits. Then give it one bounded task: explain a bug, write tests, implement a focused change, or review a diff. Keep a second pane open with your test command and run tests after every meaningful change. Review changes with git diff before staging them.
For cost control, choose a faster, lower-cost model for exploration, file discovery, and simple test updates; reserve stronger models for complex architecture, debugging, or security-sensitive reviews. Because 59API offers low-cost pay-as-you-go access and a referral rebate, it is a sensible option for developers who want to use Claude Code frequently while keeping API spending visible and flexible. Sign up for 59API when you are ready to connect your terminal workflow to affordable Claude access.
6. Keep the setup reliable
Periodically update iTerm2, Claude Code, and your shell tools. If authentication fails, first check that the environment variables exist with echo $ANTHROPIC_BASE_URL, confirm your key is active in 59API, and restart the terminal session. With a dedicated iTerm2 profile, secure environment variables, split-pane verification, and disciplined Git reviews, Claude Code becomes a fast daily development tool rather than a black box.