Reputation: 1371
I am using oh-my-zsh for my terminal. I have set IntelliJ to use /bin/zsh
as the shell path. However no environment variable in my .zshrc
file ever seems to get picked up. I'm defining environment variables like this (for instance):
export GOOGLE_APPLICATION_CREDENTIALS="$HOME/mailcreds.json"
But if I run:
echo $GOOGLE_APPLICATION_CREDENTIALS
Nothing comes up.
Upvotes: 9
Views: 19715
Reputation: 101
I solved it by opening Intellij using the terminal. You need to create Command Line Launcher if one doesn't exist.
Tools
-> Create Command-line Launcher
idea
This will open Intellij and start your app, this should be able to access your system environment properties.
Upvotes: 0
Reputation: 7754
For Ubuntu, I edited my IDE desktop launcher to run zsh with login interactive:
/usr/share/applications
(where the desktop entry usually located or /var/lib/snapd/desktop/applications
if you're using Snap).jetbrains-idea.desktop
(might be named differently).Exec
field to include /bin/zsh -l -i -c "/opt/intellij/bin/idea.sh"
.The final result of the file:
[Desktop Entry]
Version=1.0
Type=Application
Name=IntelliJ IDEA Ultimate Edition
Icon=/opt/intellij/bin/idea.svg
Exec=/bin/zsh -l -i -c "/opt/intellij/bin/idea.sh" %f
Comment=Capable and Ergonomic IDE for JVM
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-idea
StartupNotify=true
Upvotes: 4
Reputation: 81
For me, the issue was that I load tmux
automatically using .zshrc
.
I followed the solution here: https://youtrack.jetbrains.com/articles/IDEA-A-19/Shell-Environment-Loading
Wrapped just the export ZSH_TMUX_AUTOSTART=true
like this:
if [ -z "$INTELLIJ_ENVIRONMENT_READER" ]; then
export ZSH_TMUX_AUTOSTART=true
fi
Upvotes: 7
Reputation: 949
Shared the same wrong behavior with Intellij in Manjaro (Arch), which uses zsh by default.
The issue comes with Flatpak, switching to Snap or downloading binaries directly from vendor's page got this solved.
Is similar to this issue (PyCharm): https://github.com/flathub/com.jetbrains.IntelliJ-IDEA-Ultimate/issues/23.
Upvotes: 1
Reputation: 402325
Set environment variables in ~/.profile
instead of ~/.bashrc
or ~/.zshrc
, see this issue for details.
Upvotes: 12