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 1 year has passed since last update.

備忘録:m1 MacBookAirを再起動したらrubyのversionがシステムのもので固定されてrbenv localで動かせなくなり、rails sが効かなくなった件

Last updated at Posted at 2023-07-04

なぜかrails sが効かない。PC再起動までは動いていたので、rails gemがないはずもない。

kishimotokohei@MacBook-Air-3 narou-osusume-cloud9 % rails s
Rails is not currently installed on this system. To get the latest version, simply type:

    $ sudo gem install rails

You can then rerun your "rails" command.

railsプロジェクト内でrubyのバージョンを確認

kishimotokohei@MacBook-Air-3 narou-osusume-cloud9 % ruby -v
ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.x86_64-darwin21]

あれ?バージョン違うな。と、ここでrbenv localしてもバージョン変わらず。

どのrubyを使っているかを確認→システムのだった。

kishimotokohei@MacBook-Air-3 narou-osusume-cloud9 % which ruby
/usr/bin/ruby

zshrcを再読み込みし、rubyのパスを確認。rbenvの方のパスを見に行っていることを確認

kishimotokohei@MacBook-Air-3 ~ % source ~/.zshrc 
kishimotokohei@MacBook-Air-3 ~ % which ruby
/opt/homebrew/opt/rbenv/shims/ruby

バージョンを確認

kishimotokohei@MacBook-Air-3 narou-osusume-cloud9 % ruby -v
ruby 3.2.1 (2023-02-08 revision 31819e82c8) [arm64-darwin21]

rails s→動いた!よかったよかった。

kishimotokohei@MacBook-Air-3 narou-osusume-cloud9 % rails s
=> Booting Puma
=> Rails 7.0.4.2 application starting in development 
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 5.6.5 (ruby 3.2.1-p31) ("Birdie's Version")
*  Min threads: 5
*  Max threads: 5
*  Environment: development
*          PID: 2454
* Listening on http://127.0.0.1:3000
* Listening on http://[::1]:3000
Use Ctrl-C to stop
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?