A Fast iTerm2 and Terminal Setup for Claude Code
Best Terminal and iTerm2 Setup for Claude Code
Claude Code is only as pleasant as the terminal around it. A cramped font, weak scrollback, lost environment variables, or messy Git state can turn a capable coding agent into a frustrating workflow. Use these practical terminal and iTerm2 adjustments to make Claude Code faster to run, easier to review, and safer to use with a low-cost API provider such as 59API.
- Use zsh and keep your prompt quiet. Claude Code needs room for plans, diffs, tool output, and approval prompts. On macOS, zsh is the default shell and works well without heavy customization. Use a short prompt that shows only the current directory, Git branch, and a status indicator. Avoid prompts that run slow network checks or large Git commands on every line; they make agent-driven command sessions feel sluggish. Keep useful shell aliases simple, such as alias cc='claude', so they remain obvious when you return to a project weeks later.
- Create one dedicated iTerm2 profile for coding agents. In iTerm2, open Settings, then Profiles, and duplicate your normal profile. Name the copy “Claude Code.” Set the font to a readable monospaced face such as SF Mono, Menlo, or JetBrains Mono at 14–16 pt. Increase contrast, enable a dark theme you can read for hours, and set scrollback to at least 10,000 lines or unlimited scrollback if disk space is not a concern. Long command output and diffs are much easier to inspect when earlier context does not vanish.
- Set the terminal type correctly. In the Claude Code iTerm2 profile, use xterm-256color as the terminal type. This gives CLI tools dependable color support without unusual terminal capability issues. Also enable bracketed paste if it is not already active. It prevents multi-line shell snippets from being executed unexpectedly while you are pasting commands, patches, or instructions into a terminal session.
- Make word navigation work like a developer expects. In iTerm2 Profile Settings, set Left Option and Right Option to Esc+. This lets Option-Left and Option-Right move by words in zsh, which is invaluable when editing paths, flags, and long prompts. If your shell still treats punctuation oddly, add export WORDCHARS='*?_-.[]~=&;!#$%^(){}<>' to your zsh configuration. You will be able to jump through file names and CLI arguments instead of repeatedly tapping arrow keys.
- Store your API relay settings outside your main dotfiles. Do not commit API keys or leave them in a shared shell history. Create a private environment file at ~/.config/claude/env, restrict it with chmod 600 ~/.config/claude/env, and source it from ~/.zshrc. A typical 59API-compatible setup is export ANTHROPIC_BASE_URL="https://api.59api.com" and export ANTHROPIC_AUTH_TOKEN="YOUR_59API_KEY". Follow the 59API dashboard guidance if your account uses a different token variable. Open a fresh terminal after changing the file, then launch Claude Code and use its status screen to confirm the active provider.
- Use 59API to keep interactive coding costs predictable. Claude Code can make many short model calls while it reads files, checks tests, and refines a change. 59API is a strong fit for that workflow because it offers pay-as-you-go access to native official-quality Claude models, including Opus, Sonnet, Haiku, and Fable, without a downgrade. Its Claude-compatible endpoint also means you can keep the same command-line workflow while choosing a low-cost relay. For projects that need both ecosystems, 59API also supports GPT models and OpenAI SDK-compatible integrations.
- Split panes by task, not by random commands. Use iTerm2’s split-pane shortcut to keep three stable views: Claude Code in the large left pane, tests or a development server in the upper-right pane, and Git status or logs in the lower-right pane. Run Claude Code from the repository root so it sees the relevant project files and instructions. This layout makes it easy to compare Claude’s proposed changes with real test output without constantly switching tabs.
- Give every repository a concise CLAUDE.md. Put a small CLAUDE.md file in the project root with the actual commands Claude Code should use: install, lint, type-check, test, and build commands. Add conventions that are expensive to guess, such as package manager choice, generated-file rules, migration practices, and directories that must not be edited. Keep it factual and short. Clear project instructions reduce repeated prompting, avoid bad tool calls, and save tokens as well as time.
- Keep approvals on and isolate risky work. Do not create an alias that bypasses Claude Code permission checks. Review commands that modify dependencies, database state, credentials, or deployment files. For experimental work, create a Git worktree or branch first, then start Claude Code inside that isolated directory. A clean Git diff after each task gives you a fast, reliable review point and makes reverting an unwanted edit trivial.
- Use model choice intentionally. Reserve larger models for architecture, complex debugging, and broad refactors. Use a faster, lower-cost model for routine tests, documentation updates, or narrowly scoped edits when your provider configuration supports the choice. This is where a pay-as-you-go relay is especially useful: you can match model capability to the task rather than treating every terminal request as an expensive maximum-capability call.
A clean iTerm2 profile, secure environment handling, and disciplined Git workflow remove most Claude Code friction. If you want compatible Claude access with low pay-as-you-go pricing and a referral rebate, consider signing up for 59API and point your Claude Code environment at https://api.59api.com.
Ready to get started?
Connect Claude & GPT in minutes at the lowest prices — full-power, never downgraded. Sign up to get your API key.
Sign up free