How to allow Junie to execute terminal commands in your WSL 2 environment
Martijn | Developer
JetBrains recently released Junie, an AI-powered assistant for your IDE. While it works with WSL 2, it can have issues executing terminal commands. This causes it to get stuck in its workflow. In this article, we'll show you how to implement the workaround mentioned by andreas.hochhalter.

What is Junie?
Junie is an AI-powered assistant that you can install as a plugin in your JetBrains IDE. It integrates directly with your development environment, providing context-aware suggestions, code explanations, and the ability to execute terminal commands.
With Junie, you can:
- Get intelligent code completions
- Generate code based on natural language descriptions
- Debug issues more efficiently
- Give permission to execute required terminal commands
- And much more
Allow Junie to execute terminal commands with PowerShell
If you're using WSL 2 as your development environment, you'll need to make a few adjustments to ensure Junie can properly execute terminal commands.
Step 1 - Create a Network Drive
The first step is to create a network drive that points to your WSL 2 distribution.
- Open File Explorer.
- Right-click on "This PC" and select "Map network drive".
- Choose a drive letter (e.g., X:).
- In the folder field, enter
\\wsl.localhost\Ubuntu
). - Leave the "Reconnect at sign-in" and "Connect using different credentials" options as they are.
- Click "Finish".
This creates a network drive that provides direct access to your WSL 2 file system from Windows.
Step 2 - Configure PhpStorm Terminal Settings
Next, you need to configure PhpStorm to use PowerShell as the terminal:
- Open PhpStorm.
- Go to Settings (File > Settings or Ctrl + Alt + S).
- Navigate to Tools > Terminal.
- In the "Shell path" field, enter
powershell.exe -NoLogo
. - Make sure option
Run Commands using IDE
is checked. - Click "Apply" and "OK".
Step 3 - Open Your Project from the Network Drive
Now you need to open your project from the network drive you created.
- In PhpStorm, go to File > Open.
- Navigate to your network drive (e.g., X:).
- Find and open your project.
Or navigate to the folder and use the Windows context menu (option "Open Folder as PhpStorm Project").
Once you open the project from the network drive, Junie should be able to execute terminal commands.
Step 4 - Executing commands in WSL environment (optional)
If you want to execute commands directly in your WSL environment using PhpStorm's terminal, follow the steps below.
- Open the terminal window in PhpStorm.
- Click the chevron icon next to the plus icon in the terminal window.
- Select your WSL distribution (e.g., "Ubuntu").
- Navigate to your repository's folder with
cd
. - Enter your command and press enter to execute it.
Troubleshooting
If you still encounter issues with Junie executing terminal commands in WSL 2, check the following:
- Make sure your network drive is properly mapped and accessible
- Verify that PhpStorm is configured to use PowerShell as the terminal
- Ensure you've opened your project from the network drive
- Restart PhpStorm after making configuration changes
Tip
For the best experience you should use the latest versions of PhpStorm, WSL 2 and Junie.
Conclusion
By following these steps you should be able to solve the problem of Junie not being able to execute terminal commands in your WSL 2 environment. I did not have any problems like PhpStorm slowing down due to the use of a network drive instead of the regular access.
If Junie still isn't able to execute terminal commands after following this guide, just copy the repository outside WSL 2 and run it locally. This should always work. Once finished, you can copy the changes back to the folder in your WSL 2 environment.
It's nice to get it working, but let's hope this workaround won't be needed in the future!