LoginSignup
0
0

More than 3 years have passed since last update.

Your Ruby version is 2.4.6, but your Gemfile specified 2.6.4

Last updated at Posted at 2020-07-04

マイグレーションファイルを作成しようとしたら、RubyのバージョンがGemfileで指定しているものと違うと言われ、実行できなかった。

$ bin/rails g migration hoge
Your Ruby version is 2.4.6, but your Gemfile specified 2.6.4

rbenvがインストールされていることを確認。

$ which rbenv
/usr/local/bin/rbenv

指定されたRubyのバージョンをインストール。

$ rbenv install 2.6.4
Downloading openssl-1.1.1g.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
Installing openssl-1.1.1g...
Installed openssl-1.1.1g to /Users/tamu/.rbenv/versions/2.6.4

Downloading ruby-2.6.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.4.tar.bz2
Installing ruby-2.6.4...
ruby-build: using readline from homebrew
Installed ruby-2.6.4 to /Users/tamu/.rbenv/versions/2.6.4

インストールされたことを確認。

$ rbenv versions
  system
* 2.4.6 (set by /Users/tamu/.rbenv/version)
  2.6.4

今回は、特定のディレクトリ配下にのみ適用したかったので、以下のように指定。

$ rbenv local 2.6.4

切り替わったことを確認。

$ ruby -v
ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-darwin18]
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