Skip to content

IntelliJ IDEA "Cannot Connect to Already Running IDE Instance" Error

Problem Statement

When attempting to launch IntelliJ IDEA on macOS, Linux, or Windows, you may encounter an error preventing the IDE from starting:

Cannot connect to already running IDE instance.
Exception: Process [ID] is still

This occurs when IntelliJ detects a phantom process or lock file residue from a previous session, often due to:

  • Unexpected IDE or system crashes
  • Improper shutdown sequences
  • Background processes failing to terminate

The error prevents IDEA from launching, requiring manual intervention to resolve.

1. Terminate the Stuck Process (macOS/Linux)

Recommended when: You know the exact process ID (PID) from the error message

  1. Open Terminal
  2. Execute the kill command with your PID (replace [PID]):
bash
kill -9 [PID]
bash
# Example for PID 427:
kill -9 427

WARNING

Verify the process belongs to IntelliJ using ps -p [PID] first. Killing unrelated processes could crash other applications.

2. Delete the Lock File

Recommended when: Process termination fails or PID is unavailable

  1. Locate IntelliJ's configuration directory for your OS:
bash
~/Library/Application\ Support/JetBrains/[PRODUCT][VERSION]/
bash
~/.config/JetBrains/[PRODUCT][VERSION]/  # or ~/.var/app/... for Flatpak
powershell
$env:APPDATA\JetBrains\[PRODUCT][VERSION]\
  1. Remove the lock file:
bash
rm -f .lock

Finding Configuration Directory

Replace [PRODUCT][VERSION] with your specific IDE version:

  • IntelliJ: IdeaIC2023.2
  • PyCharm: PyCharm2023.2
  • WebStorm: WebStorm2023.2

Search for the .lock file using:

bash
find ~ -type f -name '.lock' 2>/dev/null

3. Alternative Solutions

Kill All IDEA Processes (macOS/Linux)

bash
sudo killall -9 idea

Restart Computer

Use as a last resort when other methods fail. Clears all residual processes and locks.

Solution Hierarchy

  1. First attempt: Terminate the specific PID
  2. If PID missing/unknown: Delete .lock file
  3. If lock file location unknown: Use find command
  4. Persistent issues: Try killall or restart

Prevention

  • Always exit IntelliJ properly using File > Exit
  • Install stable versions and updates
  • Avoid force-quitting the IDE unless necessary

Platform-Specific Paths

OSTypical Lock File Location
macOS~/Library/Application Support/JetBrains/IdeaIC2023.2/.lock
Linux~/.config/JetBrains/IntelliJIdea2023.2/.lock
Flatpak~/.var/app/com.jetbrains.IntelliJ-IDEA-Community/config/JetBrains/...
Windows%APPDATA%\JetBrains\IntelliJIdea2023.2\.lock

Resolving this error ensures interrupted work sessions can be quickly resumed without IDE reinstalls or configuration loss.