0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

irbで日本語入力できない、rbenvでRubyのバージョンが指定できない

0
Posted at

**プロを目指す人のためのRuby入門(1章-6)**を進める際に、躓いたところを記載しています。

問題

・irbで日本語入力できない(文字化けされる)

・rbenvでRubyのバージョンの切り替えができない

やったこと

・irbで日本語入力できない(文字化けされる)

readlineがインストールされていないため、一度アンインストールし、

$ rbenv uninstall 2.6.5
$ brew install readline
Warning: readline 8.0.1 is already installed and up-to-date
To reinstall 8.0.1, run `brew reinstall readline`

$ brew reinstall readline  #長いメッセいーじの後に🍺このマークが表れれば成功だと思います
$ brew link readline --force
$ RUBY_CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline)"
・rbenvでRubyのバージョンの切り替えができない
$ rbenv install 2.6.5  を実行後、
$ rbenv global 2.6.5
$ rbenv versions  このコマンドではversion2.6.5が設定されているようだが、
  system
* 2.6.5
$ ruby -v
ruby 2.6.0p0  こちらでは反映されていなかった。

いろんな方のサイトを見ても解決できなかったですが、こちらの記事の「rbenvで2.6.1に切り替える」の「バージョン切り替え後半」をそのまま行うと解決しました。
(https://qiita.com/SAYJOY/items/be06302ae8a2fac7f0c4)

その後、irbを起動しようとすると以下のエラーが発生し、起動できませんでした。

$ irb  
can't find gem irb (>= 0.a) with executable irb (Gem::GemNotFoundException) と言うエラーが出る

gem 側でもirbをインストールする必要があるそうです

$ gem install irb

これで無事、ターミナルでRubyの操作ができそうです。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?