'Where does ZSH loads the env variable from
I am trying to change the ruby version with rbenv, it seems that there is an env variable
RBENV_VERSION=3.0.1
I cannot find where does this comes from, there is no declaration on .zshrc file.
On the .szhenv file I have the following
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
Is there any other file that could define this env variable?
Solution 1:[1]
It's most likely the eval "$(rbenv init -)" line. That runs rbenv init - and then runs the output as shell commands.
If that doesn't help, you can add setopt xtrace to the start of your .zshenv. This will dump every command the shell runs to stderr, with file names and line numbers. You can then do zsh -il 2>trace.log and search trace.log for RBENV_VERSION.
From the rbenv github page, it looks like you can use rbenv shell <version> to set the version for a shell session, which sets $RBENV_VERSION.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | yut23 |
