Install ruby 2.7.3 on Mac M1 issue - macos

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.)

Related

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.

Ubuntu not using RVM ruby version

I"m using Ubuntu and RVM. I've run the command
rvm use 2.1.2
Running
ruby -v
gives me the 2.1.2 version.
When I start rails I get the following error
Your Ruby version is 2.3.1, but your Gemfile specified 2.1.2
But RVM doesn't even have 2.3.1 installed.
You may have apt installed ruby. For example, when I run apt show ruby, on my system, I get this
$ apt show ruby
Package: ruby
Version: 1:2.3.0+1
Priority: optional
Section: interpreters
Source: ruby-defaults
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss#lists.ubuntu.com>
...
Clearly, the ruby version is 2.3.x here. So I suggest you apt remove ruby first. If that doesn't solve the problem, it is possible that there is a problem with your $PATH environment variable.
ruby -v gives you the ruby version installed on your system, not the current ruby version used by RVM.
To see which ruby version is currently used by RVM, use rvm list. Make sure it's using ruby version 2.1.2 by running rvm use ruby-2.1.2
From your question, it seems Rails is using your system ruby instead of RVM ruby.

github-pages gem failing even though I have Ruby version 2.1.2

I'm trying to install github pages gem on my Mac OS X (yosemite).
I get following error:
Gem::InstallError: github-pages requires Ruby version ~> 2.0.0.
An error occurred while installing github-pages (4), and Bundler cannot continue.
Make sure that `gem install github-pages -v '4'` succeeds before bundling.
I checked my Ruby version by running following command -
ruby --version
And it says
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
So I definitely have Ruby version ~> 2.0.0
Any assistance on this issue would be greatly appreciated!
There is a possible lack of important information here. Looking at your Ruby version, are you using rbenv or rvm?
I could imagine this happening if you use rbenv or rvm and then su or sudo to gem install github-pages. rbenv and rvm are specific to your user account and your shell environment. If you su or sudo to root, rbenv and rvm are no longer active.
The other possibility is that you are running it inside of a Bundler managed app that specifies another Ruby version in the Gemfile using the ruby x.x.x syntax.
If neither of these is the case, try running gem env to see what exactly rubygems thinks the story is. Also post the exact commands you are using to get this error.

How do I run boxen in Mavericks with rbenv installed?

I recently upgraded to Mac OS 10.9 and now I get this message when I run boxen:
Bundler is not compatible with Ruby 2.0 or Rubygems 2.0. Please
upgrade to Bundler 1.3 or higher. Can't bootstrap, dependencies are
outdated
I imagined that I could just set boxen's .ruby-version file to something like 1.8.7, but based on the message above, it still seems to be using Ruby 2.0.
How can I run boxen in Mavericks?
I ran into the exact same issue. The answer is actually deceptively simple. Since Mavericks now includes Ruby 2.0.0p247 and Rubygems 2.0.3, and you apparently upgraded, your system ruby will not find your bundler or ansi gems. So what you need to do is install both with your system ruby, as root.
sudo /usr/bin/gem install bundler
sudo /usr/bin/gem install ansi
Then just restart or terminal. You can now run boxen as you would normally. Also, in order not to keep old files lying around, you may want to cleanup /Library/Ruby/Gems/1.8/ because it will include your old installation of both bundler and ansi on a ruby and gem installation you no longer have.
Seems the problem is with bundler. Just try to update it.
gem install bundler
system ruby (now 2.0) needed an updated version of bundler. Currently, only a pre-release version is compatible with Mac OS 10.9. If gem install bundler complains that you need a newer version of Bundler, as above, try gem install bundler --pre. Also, you may need elevated privileges to install gems for your system's ruby.
I am still confused about why Boxen wants to use system ruby's bundler gem when a different ruby installation is defined by Boxen's rbenv config, but the problem has a working solution now.

Resources