brew install direnv
# 对于Bash
eval "$(direnv hook bash)"
# 对于Zsh
eval "$(direnv hook zsh)"
source ~/.bash_profile # 对于Bash
source ~/.zshrc # 对于Zsh
# 在项目根目录下,运行以下命令以允许direnv更改环境变量
direnv allow
direnv 多项目环境变量管理
2 min read
brew install direnv
# 对于Bash
eval "$(direnv hook bash)"
# 对于Zsh
eval "$(direnv hook zsh)"
source ~/.bash_profile # 对于Bash
source ~/.zshrc # 对于Zsh
# 在项目根目录下,运行以下命令以允许direnv更改环境变量
direnv allow