Comments (2)
Sorry that this cost so much time to track down for people using Ruby debugger from VS Code.
The primary reason why we suggest putting rbenv initialization in zshrc
is because we only wanted rbenv shell integrations to be loaded in interactive mode and not in non-interactive mode.
This is what eval "$(~/.rbenv/bin/rbenv init - zsh)"
does in one's shell:
- Adds
rbenv
to PATH (if not already on PATH) - this is only necessary for invokingrbenv
commands; - Prepends rbenv's
shims
directory to PATH - this is crucial for ruby version switching; - Loads rbenv shell completions;
- Executes
rbenv rehash
to make sure rbenv shims are up to date; - Loads rbenv shell integrations (e.g. making
rbenv shell
command possible).
Only item (2) is actually necessary for ruby version switching; everything else is just convenience primarily made for interactive shells.
In summary, if someone wanted to ensure that their ruby version switching stays active in a non-interactive zsh shell, they should add this to their ~/.zshenv
(assuming the default RBENV_ROOT setting):
export PATH="$HOME/.rbenv/shims:${PATH}"
But to aid interactive shells, they should still be adding the evalβ¦
line to their zshrc
file. You can imagine that making a full setup like this is hard to document and explain in our setup guide. We went the easy path, leaving most of the fine-tuning as the responsibility of the user. Unfortunately, I suspect that most users aren't aware of shell nuances like this, and I wish we could do this better. But to improve the situation, we would have to move from manual setup (i.e. having users follow installation instructions) and onto a more automated setup (i.e. an installation script editing files like zshenv and zshrc for you).
Do others have a strong opinion on how rbenv could improve in this regard?
Ref. https://github.com/rbenv/rbenv/wiki/Unix-shell-initialization#zsh
from rbenv.
@ono-max Hi, Thanks you for filing this. I also heard this background from @ko1.
In my understanding, the reason of using ~/.zshrc
in README.md is only for new people. We should avoid to confuse what is best place of rbenv configuration. So, it's not technical reason.
@mislav Do you have any opinion about prefer to use ~/.zshrc
?
from rbenv.
Related Issues (20)
- version `GLIBC_2.38' not found HOT 2
- `rbenv doctor` warns about multiple paths, one symlinks to the other HOT 1
- homebrew ruby: gem command not found
- Multiple instances of rbenv-install HOT 2
- `gem-rehash` inop for `bundle install`
- GOV UK
- Shim doesn't work for Ruby 3.3.0 HOT 5
- Error when use "gem" HOT 1
- readme installation guide missing step? HOT 1
- install ruby 3.2.0 rbenv/1.1.2/libexec/rbenv: No such file or directory
- bundle command does not do anything. HOT 2
- Issues with Ruby Version Not Matching Gemfile Specification and Bundler Path on macOS Ventura HOT 9
- rbenv.bash: line 8: syntax error near unexpected token `(' HOT 6
- Permission issues on MacOS besides set the ruby version with rbenv HOT 3
- Compile a list of all places where we change what is shown on the printed version of a page
- Zsh completions doesn't display list of available commands when pressing tab HOT 10
- Ruby
- Gem
- macOS installation - last step needs clarification HOT 4
- rbenv init creates duplicates in PATH HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rbenv.