The night the diff stayed in the terminal
I was tidying up some Kotlin in the Android version of my wallpaper app, inside Android Studio, when I asked Claude Code for a small refactor. The proposed change scrolled past in the terminal as + and - lines. The IDE's diff viewer never opened. The plugin was installed, and I had already restarted the IDE.
The cause was embarrassingly simple: I had launched claude from a separate macOS terminal app. The plugin connects automatically only to a claude running in the IDE's integrated terminal; from an outside terminal you have to connect explicitly with /ide. It wasn't a settings problem. It was an assumption about where I started the process.
This page is for anyone who wants Claude Code inside a JetBrains IDE — IntelliJ IDEA, PyCharm, WebStorm, Android Studio, and the rest — and wants to get from "installed but nothing happens" to a working setup in about five minutes, then fold it into daily work. Everything here was checked against the official JetBrains page on code.claude.com as of November 2026.
The one thing to know first: the CLI and the plugin are separate
The JetBrains plugin does not bundle Claude Code. It runs the claude command in the IDE's integrated terminal and connects it to a small MCP server the IDE hosts (the server is named ide). So setup always has two parts:
- Install the Claude Code CLI, so
claudeis on your PATH. - Install the "Claude Code [Beta]" plugin from the JetBrains Marketplace and restart the IDE.
If claude isn't on the PATH, the plugin shows a "Cannot launch Claude Code" notification. When you see that, look at the CLI, not the plugin.
Setup, as of November 2026
1. Install the CLI
The official quickstart now leads with the native installer. The npm install -g route that an earlier version of this page recommended is still supported, but it's listed as an alternative.
# macOS / Linux / WSL (the quickstart's default)
curl -fsSL https://claude.ai/install.sh | bash
# Windows PowerShell
irm https://claude.ai/install.ps1 | iex
# Homebrew (does not auto-update; run brew upgrade yourself)
brew install --cask claude-code
# Confirm it worked: you should see a version number
claude --versionIf you do use npm, the current docs require Node.js 22 or later, and they recommend upgrading with npm install -g @anthropic-ai/claude-code@latest rather than npm update -g, because npm update -g respects the semver range from the original install and may not reach the newest release. Don't install with sudo; an install that needs it can't update itself.
2. Install the plugin
- Open Settings → Plugins → Marketplace and search for
Claude Code. - Install "Claude Code [Beta]" (ID 27310 on plugins.jetbrains.com).
- Restart the IDE.
An older version of this page mentioned a claude code install-jetbrains command. I couldn't find it anywhere in the official docs, so I've removed it. The Marketplace is the supported route.
Any paid Claude plan (Pro, Max, Ultra, Team, or Enterprise) or a Claude Console account works, and no API key is needed. You'll be asked to log in the first time you run claude.
3. Connect
Run claude from the IDE's integrated terminal and the integration turns on by itself. If you prefer an external terminal such as iTerm2 or Windows Terminal, start claude and type /ide:
$ claude
> /ide
Connected to IntelliJ IDEA.That confirmation line is the example from the official docs. Start claude from your IDE project root if you want it to see the same files the IDE does.
A small script to check the connection
When the diff viewer refuses to open, I've found it faster to look at the lock files than to stare at the IDE. Per the docs, the plugin writes ~/.claude/ide/<port>.lock each time the IDE starts, and the CLI uses the auth token in that file to connect to ws://127.0.0.1:<port>. If you set CLAUDE_CONFIG_DIR, the files live under its ide/ folder instead.
This script lists the lock files and checks whether each port answers. It never prints the token.
#!/usr/bin/env bash
# ide_check.sh — check the Claude Code <-> JetBrains plugin link (never prints the token)
dir="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/ide"
ls "$dir"/*.lock >/dev/null 2>&1 || { echo "no lock: the IDE plugin is not running"; exit 1; }
for f in "$dir"/*.lock; do
port="$(basename "$f" .lock)"
keys="$(python3 -c 'import json,sys; d=json.load(open(sys.argv[1])); print(",".join(k for k in d if "token" not in k.lower()))' "$f" 2>/dev/null)"
if (exec 3<>"/dev/tcp/127.0.0.1/$port") 2>/dev/null; then state="LISTEN"; else state="no answer (stale lock?)"; fi
echo "port=$port keys=[$keys] 127.0.0.1:$port -> $state"
doneField names inside the lock file may change between versions, so the script only lists key names instead of assuming them. I tested it on Ubuntu 22.04 with bash 5.1 and Python 3.10, using two dummy lock files and a listener on only one of the ports:
port=50123 keys=[pid,ideName,transport] 127.0.0.1:50123 -> no answer (stale lock?)
port=50124 keys=[pid,ideName,transport] 127.0.0.1:50124 -> LISTENThree ways to read it:
- "no lock" — the plugin isn't running. Check that it's enabled and that you restarted the IDE.
- only "no answer" — leftover lock files from an IDE you already closed. Reopening the IDE writes a fresh one on a new port.
- "LISTEN" but still no connection — look at where you launched the CLI (integrated terminal, or did you run
/ide?), or at WSL2 networking.
Since the output above came from dummy files, treat the key names as an example, not a spec.
Troubleshooting table
I rearranged the messages from the official troubleshooting section so you can look them up by symptom.
| Symptom (message you see) | Likely cause | How to check | Fix |
|---|---|---|---|
| "Cannot launch Claude Code" / clicking the icon gives "command not found" | CLI not installed, or the IDE can't see it on the PATH | Run claude --version in a terminal outside the IDE | Set the full path in Settings → Tools → Claude Code [Beta] → Claude command |
| Diffs show in the terminal, not the IDE | Launched from an external terminal, or Diff tool set to terminal | Where you launched claude; the Diff tool entry in /config | Connect with /ide and set Diff tool to auto |
/ide says "No available IDEs detected" | Plugin disabled, IDE not restarted, or WSL2 NAT / firewall | Run ide_check.sh above | Fully restart the IDE; for WSL2, see the next section |
| Esc doesn't interrupt Claude; focus jumps to the editor | The JetBrains terminal uses Esc for "move focus to editor" | Settings → Tools → Terminal | Uncheck "Move focus to the editor with Escape", or delete the "Switch focus to Editor" keybinding |
| Nothing works under Remote Development | Plugin installed on the local client | The plugin list on the remote host | Install via Settings → Plugin (Host) on the remote host |
| Selection isn't shared for one particular file | A Read deny rule matches that file | permissions.deny in settings.json | Expected if intentional; otherwise adjust the rule |
The last row is a feature, not a bug. If you put a file such as .env behind a Read deny rule, neither its selected text nor the "open file" notice reaches Claude. I've come to rely on that.
When Esc didn't stop anything
Early on in Android Studio, Claude started heading off in the wrong direction and I pressed Esc. Nothing stopped. Focus moved to the editor, and the work kept running in the terminal. I hadn't approved the diff yet, so no harm done, but I still remember the moment my hands froze over the keyboard.
By default the JetBrains terminal uses Esc to return focus to the editor. The official fix is in Settings → Tools → Terminal: uncheck "Move focus to the editor with Escape", or open "Configure terminal keybindings" and delete "Switch focus to Editor".
Since then, the first thing I do in any new IDE setup is send Claude a harmless request and confirm that Esc actually interrupts it.
Prove you can stop it before you let it do more. I'd rather check the brakes before I admire the diff viewer.
"No available IDEs detected" on WSL2
Pairing a Windows JetBrains IDE with Claude Code inside WSL2 sometimes fails to connect. According to the docs, the usual culprits are WSL2's NAT networking or Windows Firewall (WSL1 shares the host network and isn't affected).
First, point the plugin's Claude command through WSL (replace Ubuntu with your distribution):
wsl -d Ubuntu -- bash -lic "claude"If it still won't connect, there are two fixes:
| Approach | What you do | Requirement | Pick it when |
|---|---|---|---|
| Firewall rule (officially recommended) | Find the subnet with hostname -I inside WSL and allow inbound traffic for it | Works on Windows 10 | You don't want to change your WSL2 networking mode |
| Mirrored networking | Add networkingMode=mirrored to .wslconfig | Windows 11 22H2 or later | Other tools also trip over localhost mismatches |
For the firewall rule, run this in an elevated PowerShell. Replace 172.21.0.0/16 with the first two segments of your hostname -I address followed by .0.0/16.
New-NetFirewallRule -DisplayName "Allow WSL2 Internal Traffic" -Direction Inbound -Protocol TCP -Action Allow -RemoteAddress 172.21.0.0/16 -LocalAddress 172.21.0.0/16For mirrored networking, add this to .wslconfig in your Windows user folder, run wsl --shutdown in PowerShell, and reopen both the IDE and Claude Code:
[wsl2]
networkingMode=mirroredIf you're unsure, start with the firewall rule. It's the officially recommended path, and undoing it means deleting a single rule.
The plugin also has an "Accept connections from all network interfaces" option. Turning it on makes the IDE's MCP port reachable from your local network over unencrypted ws://, token included. The docs say to use it only when loopback can't work, so even on WSL2 I reach for mirrored networking first.
Day-to-day use once it's connected
Selection and the open file travel with every prompt
While connected, the CLI attaches your current selection and the active file's path to each prompt. You'll see a ⧉ Selected N lines from <file> line in the transcript when it happens. That's why "this function" is enough.
If you queue a message while Claude is working, it keeps the selection you had when you pressed Enter. Selecting something else afterward won't change it — worth knowing before you wonder why.
Shortcuts
| Action | Mac | Windows / Linux |
|---|---|---|
| Open or focus Claude Code | Cmd+Esc | Ctrl+Esc |
Insert a file reference with a line range (e.g. @src/auth.ts#L1-99) | Cmd+Option+K | Alt+Ctrl+K |
| New line inside a prompt (enable in plugin settings; macOS only) | Option+Enter | — |
Let Claude read the IDE's inspections
The plugin exposes one tool to the model, getDiagnostics, which returns the errors and warnings the IDE shows for a file. The docs are clear that Claude Code doesn't fetch diagnostics on its own after edits, so I ask for it in the request: "after the change, read the diagnostics for this file and tell me what's left."
If your organization allowlists MCP tools with a PreToolUse hook, note that this tool arrives as mcp__ide__getDiagnostics. It's hidden from /mcp, which makes it easy to miss.
Example: a Before/After you can review in one screen
I keep requests small enough that the diff fits on one screen. Select a Kotlin function like this, ask "don't return null — express not-found in the type," and the change opens as an IDE diff:
// Before
fun findWallpaper(id: Long): Wallpaper? {
return cache[id] ?: repository.load(id)
}
// After (reviewed and accepted in the diff viewer)
sealed interface WallpaperResult {
data class Found(val wallpaper: Wallpaper) : WallpaperResult
data object NotFound : WallpaperResult
}
fun findWallpaper(id: Long): WallpaperResult {
val hit = cache[id] ?: repository.load(id)
return if (hit != null) WallpaperResult.Found(hit) else WallpaperResult.NotFound
}When I let it update every when at the call sites in the same request, the diff ran across several screens and I lost track of what I'd approved. Now I split "change the type" and "fix the callers" into two requests.
Common misconceptions
| Misconception | What the docs say (November 2026) |
|---|---|
| Installing the plugin installs Claude Code | It doesn't bundle the CLI. Install the CLI separately and make sure it's on the PATH |
| An external terminal connects automatically | Only the integrated terminal connects automatically. From outside, use /ide |
No Diff tool entry in /config means something is broken | The entry appears only while connected to the IDE. Connect first, then open /config |
Separately, JetBrains announced Claude Agent for its own AI chat in September 2025. That's a different entry point from this plugin: it runs through a JetBrains AI subscription and doesn't share settings with the Claude Code CLI or plugin. For pricing and quotas there, JetBrains' own pages are the reliable source.
One safety note
The docs warn that in acceptEdits mode (and auto mode), Claude can modify IDE configuration files that the IDE may execute automatically, which can become a way around Bash permission prompts. Inside the IDE I keep edit approval manual and review each change in the diff viewer. Having a good diff viewer is exactly what makes manual approval feel cheap.
Where people get stuck next
Once connected, the most common next snag is "I added an allow rule and it still asks." I Added the allow Rule and the Prompt Still Appears — Reading Six Layers from /permissions walks through how to see which layer decided.
If there are files whose selection you never want shared, My read-deny rules never reached inside the folder I had allowed covers a trap in how deny rules are written. And if you're still deciding on the editor itself, Claude Code and Cursor: Stop Trusting Benchmarks, Measure on Your Own Repo may help.
Start by launching claude in the IDE's integrated terminal, sending one harmless request, and pressing Esc to make sure it stops. Once that works, the diff viewer will carry most of the rest.