Closed bradical closed 11 years ago
Sorry, for the vague description. Figured someone might have seen this before. Seems like maybe a problem about the order in which things are loaded perhaps?
I've noticed that when that error does occur, the completions are not enabled on that particular Zsh session. The odd thing is that it doesn't happen all the time.
If you have zsh, then bash completions shouldn't get sourced. Because rbenv init
(and other programs, evidently) thinks you're using bash, it means your $SHELL
value is wrong. It should be "/bin/zsh", but is probably "/bin/bash".
This can happen if you've launched zsh
from a bash session. Is zsh your login shell? Do you ever start bash? Can you grep for "SHELL" in your init files?
Strange. I used chsh -s /bin/zsh
to set my shell to zsh.
But you're absolutely right: in the windows where it works:
$ echo $SHELL
/bin/zsh
and in the windows where I get the warning:
$ echo $SHELL
/bin/bash
even though both windows appear to be running zsh. Must be something weird with ITerm2 when using a profile that specifies a starting directory. I'll poke around.
Thanks!
@bradical did you ever figure this out? I'm using iTerm too and have
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
and but can't seem to figure it out...
@OscarGodson try to set SHELL
env variable in .profile
or somewhere else before eval "$(rbenv init -)"
This should be reopened. $SHELL
is only the default shell. It doesn't actually tell you with 100% certainty what the current shell is. Usually, they're they same, but if you run zsh
as a subprocess of bash
(for testing or whatever), you'll see this error. In my case, it was because iTerm was handling this option in a strange way - I think it was starting a bash shell, then running the command inside of a bash shell. $SHELL
, then, was set to /usr/local/bin/bash
in zsh. (I intend to switch my login shell to zsh, but for now, I'm using Terminal.app for day-to-day stuff while I get zsh configured. I can then test my config in iTerm, hence the odd setup).
The solution here is to harden the shell detection bits in sub-init
. I suggest checking for $BASH
and $ZSH_NAME
. Those variables will be set on their respective shells
I'm using:
and am sometimes seeing the following errors when opening new terminal windows or tabs:
I'm assuming
rbenv
is also a sub so this is probably related.The only thing I've noticed is that when my terminal profile is set to change into a particular directory on load, this tends to happen.
Here's the relevant portion of my
.zshrc
file:Any ideas?