(Best) mechanism to share environment between command line and RubyMine

Hi (and happy new year!)

I use direnv and dotenv in different projects to manage my local dev environment, however rubymine doesn't (AFAICT) support either of these constructs (.envrc (a shell script) or .env (a list of environment variable assignments) in the project's root directory).

However rubymine doesn't seem to have a global environment support (that I can see), just per run-configuration or default-run-configuration environment variable options.

So is there some mechanism to set a per-project environment variable?
(it would make so much sense to have this in the project setup...)

NB: I'm not talking about global environment variables (see https://devnet.jetbrains.com/docs/DOC-1160), and I'm aware of a plugin that does something useful (reads .env files), but only works for pycharm (https://plugins.jetbrains.com/plugin/7861?pr=) and still needs to be set for every project.

any suggestions for how to do this so that command line and rubymine environment variable are configured in in one place?



Comment actions Permalink

I'm also a direnv user and a RubyMine user. Really frustrating to not have my direnv overrides picked up.

Comment actions Permalink

Hello, Tim,

sorry for the delay. Please vote for the corresponding feature request on our tracker:


At the moment, you can configure necessary environment variables per run configuration:


Comment actions Permalink

Old thread, but after not finding an answer, here's how I do it. The problem to workaround here is that direnv only uses exported variables and adding export breaks the EnvFile plugin. So we cheat.


Create .envfile in your project directory. Should look like this, with no exports.



Create .envrc in your project directory. Should look like this.

set -a; . ./.envfile 

Setup https://direnv.net/ for your shell. This will use .envrc to find variables which will in turn use ALL variables from .envfile since we're artificially exporting them with the "set -a".

Use the https://plugins.jetbrains.com/plugin/7861-envfile plugin for RubyMine / PyCharm / whatever. Point it to the .envfile


Please sign in to leave a comment.