Claude Code in iTerm2: A Practical 2026 Mac Setup
The best terminal setup for Claude Code makes prompts easy to edit, file changes easy to review, and API spending predictable. On macOS, iTerm2 is a practical choice because it combines configurable keyboard shortcuts, split panes, and searchable scrollback. This 2026 guide covers a focused setup, including pay-as-you-go model access through 59API.
1. Install iTerm2 and Claude Code
If you already use Homebrew, install iTerm2 with brew install --cask iterm2. Open it, then install Claude Code using the native macOS installer: curl -fsSL https://claude.ai/install.sh | bash. This downloads and runs Anthropic’s installation script; review the script first if your environment requires it.
Open a new terminal session and run claude --version. If the command is unavailable, check that ~/.local/bin is on your PATH. Run claude doctor to diagnose installation problems before changing unrelated shell settings.
2. Make output readable and prompts editable
In iTerm2, open Settings → Profiles → Text. Choose a readable monospace font such as Menlo at 13–15 points. Claude Code does not require a patched font or elaborate shell theme. Use a high-contrast color scheme that makes additions, deletions, and permission prompts easy to distinguish.
- Keep useful history: Under your profile’s Terminal settings, use a bounded scrollback buffer, such as 20,000 lines. Search it with Command+F instead of repeatedly rerunning commands.
- Fix multiline input: If Shift+Enter submits your prompt, run /terminal-setup inside Claude Code to configure supported terminal bindings. Follow any restart instructions. A backslash immediately followed by Enter is another multiline input method.
- Check shortcut conflicts: If a binding still fails, inspect iTerm2’s profile key mappings and macOS shortcuts before adding another mapping.
Test with a two-line prompt before starting real work. This catches accidental submissions while the session is still inexpensive.
3. Connect Claude Code to 59API
59API offers low-cost, pay-as-you-go access to Claude and GPT models, with compatibility for Claude Code, Codex, and OpenAI SDK clients. Its stated offering uses native, official-quality models without downgrading, making it an appealing option for developers who want capable models with usage-based spending.
For a temporary shell session, set export ANTHROPIC_BASE_URL="https://api.59api.com" and export ANTHROPIC_AUTH_TOKEN="YOUR_59API_KEY", then launch claude. Use the authentication method specified in your 59API dashboard if its instructions differ. Avoid mixing credentials from several providers in the same shell.
For regular use, load the key through your password manager or a private local shell configuration. Keep credentials out of repository files, shared terminal recordings, and committed configuration. The Anthropic variables above configure Claude Code; OpenAI SDK clients require their own base URL and API-key configuration.
Run /status to inspect the session configuration, then send a short test prompt. If authentication fails, verify the key, account balance, and endpoint before changing terminal settings. For model errors, check the exact model identifiers available through your relay account.
4. Arrange the terminal around your repository
Start Claude Code from the project directory so its working context is clear. Use Command+D for a side-by-side iTerm2 split, or Command+Shift+D for stacked panes. Keep Claude Code in one pane and your shell, tests, or development server in the other.
Before requesting edits, run git status --short to identify existing changes. Afterward, inspect git diff and run the project’s relevant checks. A separate shell makes verification convenient without interrupting the conversation.
5. Control context and model costs
Use /model to select an available model suited to the task. Sonnet is a sensible starting point for everyday development; reserve Opus for difficult reasoning and consider Haiku for smaller tasks where supported. Confirm current relay prices and availability rather than assuming every model has identical costs.
Give Claude specific files, an observable goal, and a verification command. Use /compact when a long conversation needs a summary, and /clear when starting unrelated work. These habits help control unnecessary context growth.
If this workflow fits your needs, sign up for 59API and test it on a small repository task. Review its current rates and referral rebate terms before expanding usage.
शुरू करने के लिए तैयार?
कुछ ही मिनटों में Claude और GPT जोड़ें, सबसे कम कीमत पर। साइन अप करें और API key पाएं।
मुफ़्त साइन अप