Intellij cannot launch because 'process 2' already running
I have occasionally got the error while starting IntelliJ
IntelliJ cannot launch because 'process 2' already running
The process ID sometimes changed, restarting or even re-installing Intellij doesn’t solve the problem.
I run the Flatpak version of IntelliJ
There are multiple threads for this online which suggest different solutions:
https://askubuntu.com/questions/1462372/ubuntu-cannot-launch-intellij-anymore
https://www.reddit.com/r/pycharm/comments/15esk6r/cannot_connect_to_already_running_ide_instance/
The root of the problem is the .lock
file which IntelliJ creates while starting up. If there is a unclean shutdown, there are chances that this file will exist and the product will throw the mentioned error.
Solution is to simply delete this file. This file resides in the preferences folder, which can be anywhere depending on the Operating System.
For me it resided in
rm ~/.var/app/com.jetbrains.IntelliJ-IDEA-Community/config/JetBrains/IdeaIC2023.2/.lock
simply deleting this file, solves the problem.
For Mac OS, this file would potentially reside in
/Library/Application Support/JetBrains/