Not able to use rails command on m1 mac air, keep asking me to install

➜ ~ which ruby /opt/homebrew/opt/ruby/bin/ruby ➜ ~ ruby --version ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]

how did you solve this issue?

1 Like

I do this sometimes, might help you:

  1. git clone -b 7-0-stable --single-branch GitHub - rails/rails: Ruby on Rails ~/rails
  2. cd to ~/rails
  3. bundle exec railties/exe/rails --version

If you’re using rbenv then try:

rbenv rehash

or if you use RVM then try:

source ~/.rvm/scripts/rvm

otherwise try closing / reopening the Terminal window, or in lieu of that, this:

source ~/.bashrc
source ~/.zshrc

Use sudo gem pristine --all, this solved it for me.

I thought sudo was to be avoided, that is, never used for higher level things like gems. I think if you think sudo is necessary, it’s the wrong approach. You’ll end up with similar problems later.

I agree with you. The main idea I wanted to get across is to restore the gems, no matter the mode, it can be with bundle pristine, gem pristine…

1 Like