LoginSignup
0
1

More than 3 years have passed since last update.

railsをversion指定してアプリ作成する方法

Last updated at Posted at 2020-02-29

railsをversion(5.2.4.1)指定してアプリ制作したかったのでその方法をば…

まずは現在のversionを確認

現在のrailsのversionを確認するコマンド

ターミナル
$ rails -v

現在のversion

Rails 6.0.2.1

version(5.2.4.1)を指定してインストールするコマンド

ターミナル
$ gem install rails:5.2.4.1

「/Library/Ruby/Gems/2.6.0ディレクトリに対する書き込み権限がありません。」と言われる

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
sudoを付けて再びコマンド入力
$ sudo gem install rails:5.2.4.1
MacBookのpassを入力

(入力中passはターミナルに表示されないので、入力が終わったらそのままエンターキーでOK)

ターミナル
Password:

インストール完了
(上記の様な"権限がない系のエラー"が出た時は頭にsudoを付けたらだいたい解決する説)

Successfully installed rails-5.2.4.1
Parsing documentation for rails-5.2.4.1
Done installing documentation for rails after 0 seconds
1 gem installed

現在のversionを確認する

$ rails -v

最新versionのまま…

Rails 6.0.2.1

気を取り直して、方法を変えてみる

versionを指定して新しいアプリを作るコマンド

$ rails _5.2.4.1_new ○○○○(アプリ名)

問題なさそう…?

(省略)
*
*
Bundle complete! 14 Gemfile dependencies, 64 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  bundle exec spring binstub --all
* bin/rake: Spring inserted
* bin/rails: Spring inserted

再びversion確認

$ rails -v

最新のまま…orz

Rails 6.0.2.1

ググったら
どうやら作ったアプリに入ってからversion確認してみると良さげらしい

作ったアプリに移動するコマンド

$ cd ○○○○(アプリ名)

↓ユーザーの後ろにアプリ名がくっついて表示されていればOK

○○○○(アプリ名) 

version確認

○○○○(アプリ名)  rails -v

成功!!

Rails 5.2.4.1
0
1
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
1