Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: Error installing rails: activesupport requires Ruby version >= 2.2.2. #1022

Closed
recyclablestudios opened this issue Nov 17, 2016 · 8 comments

Comments

@recyclablestudios
Copy link

JM:repositories jm$ rails new islandinkjet - postgresql
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.
JM:repositories jm$ sudo gem install rails
Password:
ERROR: Error installing rails:
activesupport requires Ruby version >= 2.2.2.
JM:repositories jm$ JM:repositories jm$ rails new islandinkjet - postgresql
-bash: JM:repositories: command not found
JM:repositories jm$ Rails is not currently installed on this system. To get the latest version, simply type:
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.

@mislav
Copy link
Member

mislav commented Nov 17, 2016

Sorry, I'm not sure what's happening on your system, so I can't really tell you how to solve this.

It's not a ruby-build problem, since you seem to already have a working Ruby version. However, if you installed Ruby with ruby-build, then I'm guessing you might manage your Ruby versions with rbenv. In that case, you should never use sudo to install gems, since that will install them in the wrong location. Instead, just do gem i rails. After that, do which -a rails to verify which executable you are running.

@mislav mislav closed this as completed Nov 17, 2016
@recyclablestudios
Copy link
Author

Thanks for your reply mislav.

When I try your solution I got this:

JM:repositories jm$ gem i rails
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

@mislav
Copy link
Member

mislav commented Nov 17, 2016

Oh, that means you are using system Ruby (the default Ruby preinstalled on macOS), and that you're not using a version through rbenv. You haven't told us how you set up your system at all, so I don't know what to tell you. But if you installed a Ruby version through ruby-build (this project) or rbenv, please first make sure it's selected (rbenv global <my-version>), and then try installing the gem again.

@recyclablestudios
Copy link
Author

recyclablestudios commented Nov 17, 2016

Thanks again mislav. It seems to be working fine now.
This is what I did:

  • I upgrade Git
  • using vi ~/.bash_profile I set my path as ..

export PATH=/usr/local/var/rbenv/shims:/usr/local/bin:$PATH

export RBENV_ROOT=/usr/local/var/rbenv

@arcseldon
Copy link

Had similar situation. which -a rails was helpful in determining that /usr/bin/rails was being picked up on PATH rather than the shim. Put the following into ~/.zshrc:

# Needed for rbenv
export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
eval "$(rbenv init -)"

@lucasdidier
Copy link

lucasdidier commented May 23, 2018

Thanks for your solution @arcseldon, it fixes my issue! However everytime I need to type the following in my terminal everytime I open a new window:

export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
eval "$(rbenv init -)"

Do you know how I can fix this problem permanently?

@nonsenseless
Copy link

@lucasdidier Did you put those lines in your shell profile as arcseldon recommended? If so, they should be automatically loaded whenever you open a terminal.

@nestorvave
Copy link

Had similar situation. which -a rails was helpful in determining that /usr/bin/rails was being picked up on PATH rather than the shim. Put the following into ~/.zshrc:

# Needed for rbenv
export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
eval "$(rbenv init -)"

Thanks thats worked for me

@rbenv rbenv locked as resolved and limited conversation to collaborators May 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants