Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eval (rbenv init -) is broken on fish #869

Closed
davidcelis opened this issue Feb 12, 2016 · 6 comments
Closed

eval (rbenv init -) is broken on fish #869

davidcelis opened this issue Feb 12, 2016 · 6 comments

Comments

@davidcelis
Copy link
Contributor

I have the following in my config.fish file, running with the latest versions of fish and rbenv from homebrew:

if test -d ~/.rbenv
  eval (rbenv init -)
end

When I start a shell, I get the following error:

rbenv: no such command `sh-'

Based on what rbenv init - returns for fish shell…

setenv PATH '/Users/davidcelis/.rbenv/shims' $PATH
setenv RBENV_SHELL fish
. '/usr/local/Cellar/rbenv/1.0.0/libexec/../completions/rbenv.fish'
command rbenv rehash 2>/dev/null
function rbenv
  set command $argv[1]
  set -e argv[1]

  switch "$command"
  case rehash shell
    . (rbenv "sh-$command" $argv|psub)
  case '*'
    command rbenv "$command" $argv
  end
end

… I'm wondering if something is wrong in setting $command for fish.

@davidcelis
Copy link
Contributor Author

A workaround is directly calling

source (rbenv init - | psub)

like the above output seems to intend

@mislav
Copy link
Member

mislav commented Feb 12, 2016

This is known and documented. If you run rbenv init fish, you will get instructions how to add rbenv init to your shell rc file:

$ rbenv init fish
# Load rbenv automatically by appending
# the following to ~/.config/fish/config.fish:

status --is-interactive; and . (rbenv init -|psub)

@mislav mislav closed this as completed Feb 12, 2016
@davidcelis
Copy link
Contributor Author

Hmmm, I pored through the README and Wiki but I didn't see any instructions like that for fish, and nothing about passing the name of the shell to rbenv init anywhere… Not findable enough, maybe? The most I saw consistently were bash and zsh instructions…

@mislav
Copy link
Member

mislav commented Feb 12, 2016

It's true that we should be telling people to run rbenv init to get instructions for their current shell, instead of giving people instructions for bash only. Maybe change step (3) of installation to suggest that you should run ~/.rbenv/bin/rbenv init and follow the instructions given?

@davidcelis
Copy link
Contributor Author

Yeah, that'd do it! 👍

@ElijahLynn
Copy link

Current shell instructions were added to the README.md in this commit 35ca51f

shotasenga pushed a commit to shotasenga/.dotfiles that referenced this issue Apr 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants