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

Comments

Projects
None yet
3 participants
@davidcelis
Copy link
Contributor

davidcelis commented Feb 12, 2016

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

This comment has been minimized.

Copy link
Contributor

davidcelis commented Feb 12, 2016

A workaround is directly calling

source (rbenv init - | psub)

like the above output seems to intend

@mislav

This comment has been minimized.

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 Feb 12, 2016

@davidcelis

This comment has been minimized.

Copy link
Contributor

davidcelis commented Feb 12, 2016

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

davidcelis commented Feb 12, 2016

Yeah, that'd do it! 👍

@ElijahLynn

This comment has been minimized.

Copy link

ElijahLynn commented Feb 24, 2017

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

senta added a commit to senta/.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