LoginSignup
2
2

More than 3 years have passed since last update.

rbenvのインストールについて(Checking for rbenv shims in PATH: not found)

Posted at

結論

シェルの確認

.zshrcファイルの作成

eval "$(rbenv init -)"
export PATH="~/.rbenv/bin:$PATH"
export PATH="~/.rbenv/bin:~/.rbenv/shims:$PATH"
の三行を追加

source ~/.zshrc

環境

  • Mac

問題点

$ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash

を実行すると、

Checking for `rbenv' in PATH: /usr/local/bin/rbenv
Checking for rbenv shims in PATH: not found
  The directory `/Users/ユーザー名/.rbenv/shims' must be present in PATH for rbenv to work.
  Please run `rbenv init' and follow the instructions.

Checking `rbenv install' support: /usr/local/bin/rbenv-install (ruby-build 20201118)
Counting installed Ruby versions: none
  There aren't any Ruby versions installed under `/Users/ユーザー名/.rbenv/versions'.
  You can install Ruby versions like so: rbenv install 2.2.4
Checking RubyGems settings: OK
Auditing installed plugins: OK

となり、

Checking for rbenv shims in PATH: not found

この部分のパスが通っていないこと。

解決法

rbenv shimsの環境パスの設定が正しくできていない、とのことなので
.bash_profile内で、

export RBENV_ROOT="$HOME/.rbenv"
if [ -d "${RBENV_ROOT}" ]; then
  export PATH="$HOME/.rbenv/bin:$PATH"
  eval "$(rbenv init -)"
fi

を記述する。これで再度確認するとOK!になるのだが、ターミナルを再起動するとまた

Checking for rbenv shims in PATH: not found

のエラーになる。

ここからが具体的な解決法。
今現在シェルがzshになっている。その上で、bash_profileファイル内に記述したのだがそれではターミナルを起動するごとにsource ~/.bash_profileをする必要がある。
結論として新たにzshrcファイル(zsh_profileファイルでもいい)を作成し、同じような記述をするとターミナルを再起動してもパスが通っている状態になっている。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2