Direnv: Can't load vars from .envrc

Created on 4 Jan 2018  路  3Comments  路  Source: direnv/direnv

Issue description

Never had problem using other ENV loading tools. But currently I'm on a RoR project in which the whole team uses Direnv with no problem. But mostly is under Ubuntu. I'm on macOS, and I'm facing the following issue since the very beginning. There's any clue to help me?

It simply won't load anything from the file.

Thank you.

Steps to reproduce

[fschuindt@warlock  ~]$ mkdir testing

[fschuindt@warlock  ~]$ cd testing

[fschuindt@warlock  testing]$ echo "FOO='BAR'" > .envrc
direnv: error .envrc is blocked. Run `direnv allow` to approve its content.

[fschuindt@warlock  testing]$ direnv allow .
direnv: loading .envrc

[fschuindt@warlock  testing]$ cat .envrc
FOO='BAR'

[fschuindt@warlock  testing]$ echo $FOO

[fschuindt@warlock  testing]$

Technical details

  • direnv version: v2.14.0.
  • OS release: macOS Sierra 10.12.4.
  • Terminal emulator: iTerm2 with OhMyZsh.

Most helpful comment

Yep, just add export in front of the things that you want to export. I think that your colleagues would have been able to help you out on this.

All 3 comments

Yep, just add export in front of the things that you want to export. I think that your colleagues would have been able to help you out on this.

You're right, @zimbatm. Thank you. Yeah, they looked but didn't spotted the missing export word. 馃槃

by the way, you can also load .env files from direnv if you prefer. You still have to add a .envrc but it would just contain the dotenv instruction. From that point it will also load things from a standard .env file.

Was this page helpful?
0 / 5 - 0 ratings