How can I make CLion Terminal start in the project directory?
Answered
Hi,
I imported a project from VCS and Terminal insists on starting in whichever directory the project was originally created.
So I have to “cd” to the correct directory, which ironically I copy/paste from Settings > Tools > Terminal > Start directory where the correct directory is shown.
How can I permanently change this to start from that directory every time I open the project?
Please sign in to leave a comment.
Hello!
On my side, I changed “Start directory” in
File | Settings | Tools | Terminal, closed the project, and reopened the project in CLion. After reopening, Terminal (View | Tool Windows | Terminal) started in the specified directory. Doesn't it work this way on your side? Does Terminal start in the directory specified inFile | Settings | Tools | Terminal | Start directoryif you close and reopen the project?The start directory in settings is already correct - where I want Terminal to start from.
And no, that is not where my Terminal starts from - that is precisely the problem.
Changing it to something else and restarting CLion has no effect on where Terminal starts.
If I then change it back to the correct directory, it goes grey.
On of these solutions should help:
- Choose a different shell, open the terminal, then close it and choose your original shell (so that the corresponding setting is rewritten)
- Close the project, go to the .idea folder inside it and delete the file called `workspace.xml` (contains terminal settings). It will be re-generated next time the project is opened.
It was using Windows Powershell.
Deleting workspace.xml worked. Thanks.
Will it have affected other important settings?
Did that workspace.xml contain all the run configurations?
They have disappeared.
Is there a way to get them back? I still have the old workspace.xml file.
Update: actually nothing works anymore. It doesn't recognise it as a Rust project. It won't build or run anything.
Aaaarrgggghhhh!
I restored from VCS, so I am back to square one with the wrong path and no ability to change the terminal programme, but I am feeling much more positive about square one it now I have seen the alternative!
It did unless you store run configurations as separate project files.
If you have a lot of customized settings in your project, you can try restoring the original
workspace.xmlfile, closing the IDE, opening the file in Notepad and removing the entire component that defines Terminal settings:Then start the IDE, change the Terminal starting dir again through the settings, reopen the project and see if it persists.
Hi Arina,
If I remove that component, it still starts in the wrong directory and still uses PowerShell even though the tool is set to use cmd.exe.
If I then edit Terminal in settings, it puts that <component> element back with what I entered, but the Terminal still starts from the same (wrong) directory and still uses PowerShell.
In other words, that component element has no effect.
It may have fixed itself by accident.
I set up some shell scripts in Run/Debug Configurations (so I wouldn't need to use the terminal directly) and the Terminal started showing the correct path/tool.