Set TERM environment variable for run/debug so it applies to every new project by default

Completed

I am running Clion 2020.3.1 on Mac OS Big Sur 11.1. There is a problem on Mac OS where the TERM environment variable is not set for run/debug which causes this error when running the system() function in a C program. "TERM environment variable not set"

I found the following on Stack Overflow https://stackoverflow.com/questions/42263743/how-to-properly-set-environment-variable-term-in-clion and then read the documentation for run/debug configuration. I can set this variable on a per project basis but it does not stay and apply when I create a new project. 

The "create configuration" from a CMake Application template says the values saved here will be used for new configurations of the same type. Does this mean new projects or just new configurations within the same project?

How would I go about setting this env variable globally to apply to all projects? If I run the project manually inside the terminal in the IDE it runs fine but run/debug doesn't run under the terminal tab. Also what terminal is clion using to run the program and is there a way to set it to be the same as the terminal tab (iterm with zsh)?

 

Thanks for any help

0
3 comments

Adding "export TERM=xterm-256color" to my zshrc file and then restarting Clion resolved the issue though I'm not sure why I did not need to do this to echo $TERM when in the terminal tab in Clion. Also it was not needed for manually running my terminal outside Clion. At some point my terminal is picking this env variable up without me setting it in the zshrc file and the run tab window in Clion is apparently sourcing my zshrc file but not picking up my zsh theme so it looks like a plain old bash terminal.

I'd still like to know how to include env vars in a template for run/debug that will be used for all projects if that is possible. It may come in handy in the future.

0

Hello!

>I'd still like to know how to include env vars in a template for run/debug that will be used for all projects if that is possible.

You can use File | New Projects Settings | Run Configuration Templates for New Projects....

1

Thank you. That works great.

0

Please sign in to leave a comment.