When i cd into a project with .ruby-version file i get an error about corresponding ruby version not installed.
$ cd my-app/
ruby-2.0.0p451 is not installed.
To install do: 'rvm install ruby-2.0.0p451'
I installed it with RVM and still have the error.
More info :
I have rvm installed and i got it working without problem for some time. I recently needed ruby-2.0.0p451 for a project, after installing i was able to use it :
$ ruby --version
ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-darwin12.5.0]
But when i add a .ruby-version file it seems RVM cannot find ruby
Here is a copy of my .bashrc and bash_profile
Related
I successfully installed ruby version to 2.7, but ruby -v doesn't want to update. See output below:
➜ ~ ruby -v
ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
Verify that Ruby 2.7 has been installed:
➜ ~ brew install ruby#2.7
Warning: ruby#2.7 2.7.6_1 is already installed and up-to-date.
To reinstall 2.7.6_1, run:
brew reinstall ruby#2.7
What am I missing?
Type which ruby to find out where it's getting that executable from.
$ which ruby
/opt/homebrew/opt/ruby/bin/ruby
homebrew will put it in /opt/homebrew/opt/ruby/bin/ruby as shown there, but if that's not in your path then it will get the system ruby.
$ which ruby
/usr/bin/ruby
In that case you need to add the homebrew ruby bin directory to your PATH. I have this in my .bashrc:
export PATH="/opt/homebrew/opt/ruby/bin:/opt/homebrew/lib/ruby/gems/3.0.0/bin:$PATH"
So I installed the newest version of Ruby:
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
By following these steps:
brew install ruby
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
I needed to change the Path so that I could use the newest version of Ruby since if not, whenever I did
ruby -v
It would just take into account the default ruby version I had installed in my MAC:
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
Everything works great but I want to install RSpec, so I do:
gem install rspec
This is what I get:
Successfully installed rspec-3.10.0
Parsing documentation for rspec-3.10.0
Done installing documentation for rspec after 0 seconds
1 gem installed
But once I check the version:
rspec --version
This is what I get:
-bash: rspec: command not found
I have uninstalled ruby with brew and installed it again and restarted the terminal but to no avail...Any idea why is this happening? How can I solve it?
Thank you!
It seems that installing Ruby via Home Brew was giving some problems when trying to run RSpec so I uninstalled it and installed it again via RVM. Although, as #Mskha said, Rbenv could also be a possible option.
I installed Ruby many moons ago but never use it. Perhaps I inadvertently broke it as I seem to be having troubles with getting it working with the sass command.
After running the brew install sass/sass/sass I get the following error with sass command:
rbenv: sass: command not found
The `sass' command exists in these Ruby versions:
2.1.10
2.5.0
ruby -v yields:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
which I'm guessing is the stock version of Ruby on a mac.
The rbenv command prints out help so it looks like I have that installed. brew list shows I have the ruby package installed. I upgraded ruby with brew but that didn't help (it reported I upgraded from 2.6.1 to 2.6.2. I don't appear to have rvm installed.
If you're using RVM you shouldn't need to brew install anything, in fact you shouldn't.
See documentation here https://github.com/sass/ruby-sass which is deprecated and will refer you to use https://github.com/sass/sassc-ruby instead.
brew uninstall any ruby and ruby packages and just use rbenv to manage your ruby versions.
Once you set your ruby version with rbenv global 2.6.1 for example or whatever version you want, then just do
gem install sassc
Or in your Gemfile add
gem 'sassc`
and run
bundle install
I'm using OS X 10.10.5 (Yosemite). I'm trying to clone the github repo for MacDown. The instructions in the README say that after cloning one should do
git submodule init
git submodule update
bundle install
bundle exec pod install
I'm not a ruby programmer, so I had to install Bundler. The first two steps ran fine, but when I tried to run bundle install I got the error
activesupport-5.0.0.1 requires ruby version >= 2.2.2, which is incompatible with the current version, ruby 2.0.0p481
So I tried brew install ruby and now I have
saul#miniMac ✓ ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin14]
However, bundle install gives me the same error message as before. It's clear that it's finding the ruby at /usr/bin/ruby instead of the one at /usr/local/bin/ruby. How do I correct this?
I thought that perhaps the problem was that I had installed bundler before upgrading ruby, neither sudo gem uninstall bundler nor sudo gem uninstall bundle has any effect, and I don't know what else to try.
Here is all the output, in case it's relevant:
saul#miniMac ✓ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies...
activesupport-5.0.0.1 requires ruby version >= 2.2.2, which is incompatible with
the current version, ruby 2.0.0p481
EDIT:
Thanks for the suggestions. I tried gem install bundler again, but it didn't help. I got the same error message. Here's what I get from bundle env
saul#miniMac ✗ bundle env
Environment
Bundler 1.13.6
Rubygems 2.0.14
Ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
Git 2.5.4 (Apple Git-61)
Gemfile
source 'https://rubygems.org'
gem 'cocoapods', '0.39.0'
Gemfile.lock
<No /Users/saul/Projects/macdown/Gemfile.lock found>
EDIT 2:
saul#miniMac ✓ which -a bundle
/usr/local/bin/bundle
/usr/bin/bundle
It seems that your PATH may have an entry that points to your older version of Ruby and despite having a newer version (2.3.1) it gets to use the first ruby binary it finds in one of the entries it finds in your PATH, which happens to be the old version. You could try to add your latest Ruby path as the first entry of your PATH variable, but in case a sub-shell is run and the default PATH is loaded the path to your latest Ruby would be overwritten. That being said, I think the easiest would be to use rvm here to make sure your environment is all set up with the version you intend to use at any given time. RVM can manage multiple versions of ruby in the same system. Read more about RVM here.
Run all the following commands in the same terminal window:
Install rvm: curl -sSL https://get.rvm.io | bash -s stable
Add rvm binary to PATH: export PATH="$PATH:$HOME/.rvm/bin"
Install ruby version you need: rvm install 2.3.1
Configure the current shell to use a specific version of Ruby like so: rvm use 2.3.1
Run bundle install again
I just cloned my Rails app onto my new computer. Ruby 2.0.0 seemed to install with no issue, but when I run sudo bundle install inside my app, I get an error telling me I have Ruby 1.9.3 installed:
$ sudo bundle install
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
and bundle install returns this:
$ bundle install
/home/user/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler (LoadError)
from /home/user/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/bin/bundle:7:in `<main>'
I don't understand why I would have 1.9.3 installed. I used the command rvm install 2.0.0 to install Ruby.
Also, ruby -v returns:
ruby 2.0.0p643 (2015-02-25 revision 49749) [x86_64-linux]
What's going on?
Output of rvm list
$ rvm list
rvm rubies
=* ruby-2.0.0-p643 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Because you're using rvm, you shouldn't ever need to use sudo on any of your commands. Using sudo is likely running the globally installed 1.9.3 version.
If you just installed Ruby 2.0.0 and haven't done anything else, then you most likely need to install bundler first before using it:
gem install bundler
Once you've done that, bundle install (without sudo) should work fine.