PATH variable is different in IntelliJ terminal v/s mac terminal

Answered

On running echo $PATH in mac terminal, I get this:

/Users/sanjanashankarikoppa/.jenv/bin:/Users/sanjanashankarikoppa/.nvm/versions/node/v14.19.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sanjanashankarikoppa/Documents/apache-maven-3.6.3/bin

On running echo $PATH in Intellij terminal, I get this:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sanjanashankarikoppa/Desktop/Workspace/cup-admin-plugin/node_modules/.bin

0
3 comments

It depends on how you set environment variables on macOS. GUI apps and terminal apps normally have different set of environment variables on this OS. If you start IntelliJ IDEA from the terminal per https://intellij-support.jetbrains.com/hc/en-us/articles/360011901879-How-to-start-IDE-from-the-command-line, it should have the same environment in its built-in Terminal.

See also https://stackoverflow.com/a/26586170/104891 for the ways to set env variables on macOS so that they are the same for all the apps.

0

I followed the steps to open the IDE using command line and this is the new path that I get:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/sanjanashankarikoppa/Desktop/Workspace/cup-admin-plugin/node_modules/.bin:/Users/sanjanashankarikoppa/.jenv/bin:/Users/sanjanashankarikoppa/.nvm/versions/node/v14.19.0/bin:/Users/sanjanashankarikoppa/Documents/apache-maven-3.6.3/bin
It looks like IntelliJ is attaching the link after the local bin

0

Please clarify the issue, do you need some extra variables in PATH or do you want to remove some variables?

0

Please sign in to leave a comment.