Skip to content

which rbenv in terminal returns function definition of rbenv #418

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

Closed
gjaldon opened this issue Jun 24, 2013 · 11 comments
Closed

which rbenv in terminal returns function definition of rbenv #418

gjaldon opened this issue Jun 24, 2013 · 11 comments

Comments

@gjaldon
Copy link

gjaldon commented Jun 24, 2013

Why does this happen? I get the below output when running which rbenv in terminal:

rbenv () {
    typeset command
    command="$1" 
    if [ "$#" -gt 0 ]
    then
        shift
    fi
    case "$command" in
        (rehash|shell) eval `rbenv "sh-$command" "$@"` ;;
        (*) command rbenv "$command" "$@" ;;
    esac
}

Was supposed to use which rbenv to detect rbenv for this plugin - maltize/sublime-text-2-ruby-tests#154. Any help would be appreciated. :)

@graywh
Copy link

graywh commented Jun 24, 2013

This is a difference between the binary (/usr/bin/which) and Zsh's built-in command of the same name.

@mislav
Copy link
Member

mislav commented Jun 25, 2013

Like @graywh said: which can be either a shell builtin or a command in your PATH. To see which you are using: type which

What you are seeing as a result for which rbenv is correct. If you want to detect the path to the rbenv executable, you can use command which rbenv.

@mislav mislav closed this as completed Jun 25, 2013
@gjaldon
Copy link
Author

gjaldon commented Jun 25, 2013

Thanks for the help @mislav and @graywh!

@kevinSuttle
Copy link

Wow, great tip @mislav. Thanks.

@sundevilyang
Copy link

➜ ~ type which
which is a shell builtin
➜ ~ command which rbenv
/usr/local/bin/rbenv
➜ ~ echo $PATH
/usr/local/opt/rbenv/shims:/usr/local/sbin:/Users/Young/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

I think the path to the rbenv executable should be ~/.rbenv/bin/rbenv, what's my problem?

@sundevilyang
Copy link

➜  ~ grep -i rbenv ~/.{bashrc,bash_profile,zshrc,zshenv,profile}
/Users/Young/.bash_profile:if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
/Users/Young/.zshrc:export PATH="/Users/Young/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Users/Young/.zshrc:eval "$(rbenv init -)"
grep: /Users/Young/.zshenv: No such file or directory
grep: /Users/Young/.zprofile: No such file or directory

@sundevilyang
Copy link

I once did the follow stuff:

curl -O https://raw.githubusercontent.com/donnemartin/dev-setup/master/.bash_profile
curl -O https://raw.githubusercontent.com/donnemartin/dev-setup/master/.bash_prompt
curl -O https://raw.githubusercontent.com/donnemartin/dev-setup/master/.aliases

source .bash_profile, and then bugs came out. I delete them all. does this cause it ?

@sundevilyang
Copy link

this is what I come across

➜  ~ rbenv install 2.3.1\
> ;
Downloading ruby-2.3.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2
^C%                                                                               ➜  ~ pc rbenv install 2.3.1
[proxychains] config file found: /usr/local/Cellar/proxychains-ng/4.11/etc/proxychains.conf
[proxychains] preloading /usr/local/Cellar/proxychains-ng/4.11/lib/libproxychains4.dylib
Downloading ruby-2.3.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2
Installing ruby-2.3.1...
Installed ruby-2.3.1 to /Users/Young/.rbenv/versions/2.3.1

➜  ~ rbenv global 2.3.1
➜  ~ ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
➜  ~ source .zshrc
➜  ~ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
➜  ~ cd Sites/cgc_website
➜  cgc_website git:(dev) ✗ gem install rails
dyld: lazy symbol binding failed: Symbol not found: _parse_numeric_port
  Referenced from: /Users/Young/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/socket.bundle
  Expected in: flat namespace

dyld: Symbol not found: _parse_numeric_port
  Referenced from: /Users/Young/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/socket.bundle
  Expected in: flat namespace

[1]    20386 trace trap  gem install rails

@mislav
Copy link
Member

mislav commented Jul 8, 2016

@sundevilyang You seem to have eventually successfully set up rbenv, as evident by Ruby version being 2.3.1 when you did rbenv -v, but the gem installation error I can't help you with, since that's not rbenv's responsibility. You'll have to search the web for the answers for that one.

@sundevilyang
Copy link

@mislav thanks, I solved it.

@FrankFang
Copy link

@sundevilyang How did you solve it?

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