Stuck on old Ruby version (macOS) - ruby

I keep trying to get ruby on my system from v 2.3.7 to v 2.7.1 but no matter what command I enter (update, install, rbenv global etc) it stays with the old version. I think it's an old installation that doesn't get overwritten when I install a new version, but whenever I try to run something with the "ruby" command it only uses the 2.3.7 install.
Here's an example of what I'm talking about. This was after was trying to uninstall everything I could to do a full reinstall, but I can't even figure out how to uninstall it. I then tried to upgrade the ruby version that the system was telling me was there, but brew couldn't find it.
$ ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
$ brew upgrade ruby
Updating Homebrew...
Error: ruby not installed

brew upgrade ruby upgrades the ruby installed by Homebrew. "Error: ruby not installed" says you don't have Ruby installed by Homebrew. Homebrew will not upgrade the Ruby that comes with MacOS.
Instead, brew install ruby. This will leave your MacOS Ruby alone and install its own.

Related

Install ruby 2.7.3 on Mac M1 issue

When I try to install the ruby 2.7.3 version on mac m1 it installs, it shows in my machine also but when I try sudo bin/setup_dev this command its show me error like
Bundling rails dependencies Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on
this machine. Your Ruby version is 2.6.3, but your Gemfile specified ~> 2.7.3
bin/setup_dev:
Failed to run 'bundle install > log/setup_dev.log', check log/setup_dev.log for more information.
aim#aim-MacBook-Air openproject % rbenv global 2.7.3
aim#aim-MacBook-Air openproject % ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
please any one can help to install ruby v 2.7.3 on mac.
Things that I try
Install ruby using rosetta 2
I am new on ruby please help on this.
thanks in advance.
Specifying a ruby version in a bundler gemfile doesn’t magically install that version of ruby. You need to start by learning to use a ruby version management system. I recommend Homebrew and rbenv.
(And not just in order to get a different ruby version. Always install your own ruby. Never use the built in system ruby for anything! If you have to say sudo you’re doing it wrong.)

can't get sass command working on mac with 'brew install sass/sass/sass'

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

Why is ruby -v still showing version 2.0.0 even after successfully installing ruby 2.5.3?

I'm following this tutorial: https://jekyllrb.com/docs/installation/macos/#homebrew
I've successfully installed ruby 2.5.3, however, when I run "ruby -v" on the command line in Terminal, it still says ruby 2.0.0.
My friend told me something about local vs universal installation of ruby and how that can create a conflict, but I'm completely new to this so I'm having trouble understanding how to update the 2.0.0 to 2.5.3 (which I've successfully installed on my machine).
I suggest you install RVM: https://rvm.io/
The install instruction is on the site.
After you're done installing RVM do.
rvm install 2.5.3
Then test with ruby -v to check if you have the version you want (2.5.3). If not we can help you from that point.

Why is reinstalling Ruby 1.8.7 failing

I tried to reinstall Ruby 1.8.7 using RVM after having troubles with Homebrew. I reinstalled Homebrew and RVM, and I have Ruby 1.9.3 and 2.0.0 working fine.
One of my projects uses 1.8.7 so when I used:
rvm install 1.8.7
I got:
The requested url does not exist(22):'http://production.cf.rubygems.org/rubygems/rubygems-2.0.9.tgz'
Checking fallback: ftp://production.cf.rubygems.org/rubygems/rubygems-2.0.9.tgz
Checking fallback: http://www.mirrorservice.org/sites/production.cf.rubygems.org/rubygems/rubygems-2.0.9.tgz
No fallback URL could be found, try increasing timeout with:
echo "export rvm_max_time_flag=20" >> ~/.rvmrc
There has been an error while trying to fetch rubygems.
Halting the installation.
I tried to do:
rvm get stable
rvm get head
curl -L get.rvm.io | bash -s stable
Which I found on another Stack Overflow question with a similar error, but it's obviously a bit different.
I run:
RVM 1.22.9 (stable)
Homebrew 0.9.4
Mac OSX 10.8.4
This was an issue with rubygems release process - https://github.com/wayneeseguin/rvm/issues/2212 and https://github.com/rubygems/rubygems/issues/651
For next time it happens you can specify which version of rubygems to use when installing ruby with rvm like this:
rvm install 1.8.7 --rubygems 2.0.8
I'm seeing essentially the same error with a chef deploy of rvm under ubuntu - ruby 1.8.7 refuses to complete installation (the ruby is there, but no gem, etc) due to a problem with 'rubygems-2.0.9.tgz'
Edited to add - if you run 'rvm rubygems 2.0.7' (latest that seems to be really available right now) it seems to work.

I'm confused, what's the easiest way to install Ruby 1.9.2 on OS X?

My current version is ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10]
Step 1. Install Homebrew: https://github.com/mxcl/homebrew
This enables you to install various *IX projects on a mac. You may need to install xcode as part of this, so you may need your OS X disc to hand. Homebrew is useful for many other things - a good thing to have installed anyway.
Step 2. Install Ruby Version Manager:
brew install rvm
Step 3. Install whichever Ruby version you want. This means you can have multiple Ruby installations (with their own sets of rubygems) running independently of one another. for 1.9.2 try this:
rvm install 1.9.2
If you get a 'readline' error, try this:
rvm package install readline
rvm remove 1.9.2
rvm install 1.9.2 --with-readline-dir=$rvm_path/usr
You should now be able to do this to test your ruby version:
ruby --version
To switch back to another version of ruby, just use the rvm command.
You can try rvm to install whatever the version of ruby.
if you will get error
undefined method `path' for Gem:Module (NoMethodError)
during command
~/rubygems-1.3.7 $ ruby setup.rb
remove ruby and rubygems with command
sudo autoremove ruby
sudo autoremove rubygem
ant try to install all again

Resources