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

rbenv shell command not found #459

Closed
mdesantis opened this issue Oct 5, 2013 · 20 comments
Closed

rbenv shell command not found #459

mdesantis opened this issue Oct 5, 2013 · 20 comments

Comments

@mdesantis
Copy link

Environment:

$ uname -srvm
Linux 3.11.0-11-generic #17-Ubuntu SMP Tue Oct 1 19:42:04 UTC 2013 x86_64
$ echo $SHELL
/usr/bin/fish
$ rbenv --version
rbenv 0.4.0-65-gff23666

When I execute rbenv shell jruby-1.7.4 rbenv outputs rbenv: no such command `shell' and the ruby environment doesn't change.

In order to mitigate this issue I'm using this:

function rbenv-shell
  set --local RUBY_VERSION $argv[1]

  if test "$RUBY_VERSION" = "--unset"
    set --global --export --erase RBENV_VERSION
  else if test -n "$RUBY_VERSION"
    set --global --export RBENV_VERSION $RUBY_VERSION
  end

  rbenv version
end
complete --command rbenv-shell --exclusive --arguments "--unset (rbenv versions --bare)"
@mislav
Copy link
Member

mislav commented Oct 5, 2013

How did you set up rbenv? Did you follow instructions from the official README? Do you have this line in your .bash_profile or .zshrc (depending on the shell you use):

eval "$(rbenv init -)"

rbenv shell is a special command that only works if you've set up the rbenv() function in your shell by means of eval'ing rbenv init - output.

@mdesantis
Copy link
Author

Since I use fish shell I set this in the config (as written in the issue #195 ):

set PATH $HOME/.rbenv/bin $PATH
set PATH $HOME/.rbenv/shims $PATH
rbenv rehash >/dev/null ^&1

Reading better the issue 195 it is a known bug, isn't it? This comment says so

@mdesantis
Copy link
Author

Here there is a patch which makes rbenv shell work, I'm trying it and it works; while this version, which supports short names, works but just correcting a tip: rbenv version -- bare should be rbenv version --bare (without the space)

@mislav
Copy link
Member

mislav commented Oct 5, 2013

Disregard the Coderwall tips. rbenv now supports fish shell in the master version. Upgrade to the latest version:

cd ~/.rbenv
git pull

Then, in your config.fish:

set PATH $HOME/.rbenv/bin $PATH
. (rbenv init -|psub)

@mislav mislav closed this as completed Oct 5, 2013
@mdesantis
Copy link
Author

Thank you! it solves the issue. I added it to the wiki https://github.com/sstephenson/rbenv/wiki/Unix-shell-initialization , if you want you can check if it is in the right place

@mislav
Copy link
Member

mislav commented Oct 5, 2013

That wiki page is about shell in general and is not a good place to add rbenv-specific documentation. I reverted your change. Don't worry about adding this documentation for now; I'll see that it's added to our README.

@mdesantis
Copy link
Author

Ok, no problem. Thank you again

@espen
Copy link

espen commented Oct 26, 2013

If I add '. (rbenv init -|psub)' to config.fish I get a lot of errors when loading a new shell instance. Just adding 'rbenv init -|psub' works but I am unable to use 'rbenv shell'. Using v.0.4.0 through homebrew.

@mislav
Copy link
Member

mislav commented Oct 26, 2013

@espen Can you update to latest head and try again? brew upgrade rbenv --HEAD

@espen
Copy link

espen commented Oct 26, 2013

Yeah just figured out that the brew package v.0.4.0 was not the same as v.0.4.0 in master. Works great. Thanks :D

@kitofr
Copy link

kitofr commented Jan 28, 2014

i end up with
krirou@iHAL ~> rbenv
env: bash\r: No such file or directory

  • just did a $brew upgrade rbenv --HEAD
  • i've patched my .config/fish/fish.config as well

ideas?

@mislav
Copy link
Member

mislav commented Jan 28, 2014

@kitofr You seem like you have another kind of issue. What is the output of which bash? How does rbenv setup in your fish.config looks like?

@kitofr
Copy link

kitofr commented Jan 28, 2014

Oh, sorry for not posting the necessaries earlier; quite new to fish and rbenv.

krirou@iHAL ~> which bash
/bin/bash
krirou@iHAL ~> cat .config/fish/config.fish 
set -x LC_CTYPE sv_SE.UTF-8
# https://github.com/sstephenson/rbenv/issues/459
set PATH $HOME/.rbenv/bin $PATH
. (rbenv init -|psub)

@mdesantis
Copy link
Author

@kitofr try status --is-interactive ; and source (rbenv init - | psub) instead of . (rbenv init -|psub)

@kitofr
Copy link

kitofr commented Jan 28, 2014

same thing unfortunately :(

@mislav
Copy link
Member

mislav commented Jan 28, 2014

@kitofr You said you installed rbenv --HEAD from Homebrew. If you did that, then remove this line from your config.fish, as you don't need it:

set PATH $HOME/.rbenv/bin $PATH

That line only applies if you've installed rbenv directly to ~/.rbenv from git.

Alternatively, if you want to keep your installation from git in ~/.rbenv (and I recommend that), then brew uninstall rbenv, keep the PATH line in shell config, and cd ~/.rbenv && git pull to ensure you've got the latest version. Then try again.

@kitofr
Copy link

kitofr commented Jan 29, 2014

Still no luck :(... i'll peek in the code and see if I can spot anything. I suppose it's something odd with my environment.

Thanks for all the help.

@mislav
Copy link
Member

mislav commented Jan 29, 2014

You can open a new issue, since your problem is unrelated to the original issue here. Include the following information:

  1. which -a rbenv
  2. rbenv --version
  3. fish version
  4. latest contents of config.fish
  5. What command do you run when you get the error; is the error always the same; the exact output including the error

@kitofr
Copy link

kitofr commented Jan 30, 2014

Hey!

I've opened a new issue here:
#541

Cheers and thanx for all the help,
Kristoffer

On Wed, Jan 29, 2014 at 3:01 PM, Mislav Marohnić
notifications@github.comwrote:

You can open a new issue, since your problem is unrelated to the original
issue here. Include the following information:

  1. which -a rbenv
  2. rbenv --version
  3. fish version
  4. latest contents of config.fish
  5. What command do you run when you get the error; is the error always
    the same; the exact output including the error


Reply to this email directly or view it on GitHubhttps://github.com//issues/459#issuecomment-33586261
.

Cheers,
Kristoffer
about.me/kitofr

@chiqui3d
Copy link

chiqui3d commented Sep 8, 2017

I solved it in ubuntu by installing coreutils again

AlexWayfer added a commit to AlexWayfer/rbenv that referenced this issue May 30, 2018
jrolfs pushed a commit to jrolfs/rbenv that referenced this issue May 21, 2019
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

6 participants
@mislav @espen @kitofr @mdesantis @chiqui3d and others