rbenv / rbenv-installer

Installer and doctor scripts for rbenv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

always thinks rbenv isn't installed because... homebrew

airtonix opened this issue Β· comments

zeno.jiricek in C02GH4X5ML7H in reckon-mobile on ξ‚  develop [✘?] via  via πŸ’Ž v2.6.3 
❯ which rbenv
rbenv not found

zeno.jiricek in C02GH4X5ML7H in reckon-mobile on ξ‚  develop [✘?] via  via πŸ’Ž v2.6.3 
❯ rm -rf ~/.rbenv

zeno.jiricek in C02GH4X5ML7H in reckon-mobile on ξ‚  develop [✘?] via  via πŸ’Ž v2.6.3 
❯ brew install rbenv
==> Downloading https://ghcr.io/v2/homebrew/core/rbenv/manifests/1.2.0
Already downloaded: /Users/zeno.jiricek/Library/Caches/Homebrew/downloads/8476c387895a8e3b29021e07d9286d6475b10b19bf561983ee0bf884ee4cd693--rbenv-1.2.0.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/rbenv/blobs/sha256:8a1b159909d472cc461d0a9b85a192a31ab58860e34f022fcbb33175732d24aa
Already downloaded: /Users/zeno.jiricek/Library/Caches/Homebrew/downloads/c088876a68ad57d293e7855050260a9d44e30d8002c40fb17a94e1d843f4c973--rbenv--1.2.0.big_sur.bottle.tar.gz
==> Pouring rbenv--1.2.0.big_sur.bottle.tar.gz
🍺  /Users/zeno.jiricek/Cellar/rbenv/1.2.0: 35 files, 106.9KB
==> Running `brew cleanup rbenv`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

zeno.jiricek in C02GH4X5ML7H in reckon-mobile on ξ‚  develop [✘?] via  via πŸ’Ž v2.6.3 took 5s 
❯ which rbenv
rbenv not found

zeno.jiricek in C02GH4X5ML7H in reckon-mobile on ξ‚  develop [✘?] via  via πŸ’Ž v2.6.3 
❯ command -v rbenv ~/.rbenv/bin/rbenv | head -1

zeno.jiricek in C02GH4X5ML7H in reckon-mobile on ξ‚  develop [✘?] via  via πŸ’Ž v2.6.3 
❯ $(brew --prefix)/bin/rbenv
rbenv 1.2.0
Usage: rbenv <command> [<args>]

Some useful rbenv commands are:
   commands    List all available rbenv commands
   local       Set or show the local application-specific Ruby version
   global      Set or show the global Ruby version
   shell       Set or show the shell-specific Ruby version
   rehash      Rehash rbenv shims (run this after installing executables)
   version     Show the current Ruby version and its origin
   versions    List installed Ruby versions
   which       Display the full path to an executable
   whence      List all Ruby versions that contain the given executable

See `rbenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/rbenv/rbenv#readme

zeno.jiricek in C02GH4X5ML7H in reckon-mobile on ξ‚  develop [✘?] via  via πŸ’Ž v2.6.3 

The install command is missing for the same reasons... using homebrew to install on mac probably means extra steps now...

also:

zeno.jiricek in C02GH4X5ML7H in reckon-mobile on ξ‚  develop [✘?] via  via πŸ’Ž v2.6.3 
❯ ls -al ~/.rbenv
ls: /Users/zeno.jiricek/.rbenv: No such file or directory

i had to update my dotfiles/zsh/parts/rbenv.zsh from :

RBENV_HOME="$HOME/.rbenv"
RBENV_BIN="$RBENV_HOME/bin"

[[ ! -d $RBENV_HOME ]] && curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash
export PATH=$RBENV_BIN:$PATH

eval "$(rbenv init -)"

to

RBENV_HOME="$HOME/.rbenv"
RBENV_BIN="$RBENV_HOME/bin"
export PATH=$RBENV_BIN:$PATH

[ command -v rbenv >/dev/null 2>&1 ] || {
    CURRENT=$(pwd)
    mkdir -p ~/.rbenv
    cd ~/.rbenv
    git init
    git remote add -f -t master origin https://github.com/rbenv/rbenv.git
    git checkout -b master origin/master
    RBENV_ROOT=$(~/.rbenv/bin/rbenv root)
    mkdir -p "${RBENV_ROOT}/plugins"
    git clone https://github.com/rbenv/ruby-build.git "${RBENV_ROOT}/plugins/ruby-build"

    cd $CURRENT
}

eval "$(rbenv init -)"

Hi, so much is going on here that I got a bit lost, but I don't think anything here is a bug with Homebrew or rbenv. I suggest cleaning up and simplifying your shell init files.

❯ brew install rbenv
❯ which rbenv
rbenv not found

This hints to the fact that your Homebrew is not properly set up. You seem to have a nonstandard Homebrew installation directory. If you've chosen your own Homebrew directory that is not /usr/local, then it's your responsibility to add Homebrew's binary directory to your PATH.

RBENV_HOME="$HOME/.rbenv"

rbenv doesn't respect any environment variable called RBENV_HOME. https://github.com/rbenv/rbenv#environment-variables

You can override this location by setting RBENV_ROOT. However, the default value is already $HOME/.rbenv, so you don't really need to set anything.

Finally, your manual installation steps look fine! If that's what's working for you, then you should keep that setup. Please note that rbenv-installer isn't suitable for everyone's use case.