MAMP Ruby vs macOS system Ruby - ruby

I am about to install a newer version of Ruby so I checked the following things-
Which ruby
/Applications/MAMP/Library/bin//ruby
ruby - v
2.6
I don't like to use Mamp ruby as I want to use a newer version of Ruby probably 2.7(as it supports the application)
Also when I do which ruby it doesn't show Mac ruby version.
Is it ok if I install a ruby version manager like chruby. Would it interfere with any other version.
Any help is highly appreciated.
Thank you.

Related

Trouble running RubyGems on Redhat 5.5

Am trying to install Ruby and RubyGems on a RedHat 5.5 machine. I'd got them by running the following two commands:
sudo yum install ruby
sudo yum install rubygems
Got both installed. However when i try to run gem, i got the following error:
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require': undefined methodend_with?' for "no such file to load --
Win32API":String (NoMethodError)
from /usr/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:55
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in
gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:inrequire'
from /usr/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:8
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in
gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:inrequire'
from /usr/bin/gem:9
Doesn't matter what kind of command i run, it throws that. (I tried gem -v, gem update)
The version of Ruby seems to be 1.8 but i have problem determining the RubyGems version. I'd vi into rubygems.rb and at the top it stats the version as 1.5.
Try to fix by running the downgrade command as proposed here, but it throws the same error as well.
Any help on fixing this issue? Just want to get this running so that i can run a RoR apps..
RedHat 5 ships with Ruby 1.8.5 and an equally old rubygems. Both, the rubygems and the ruby version is WAY too old to be supported by anything outside the base packages of the OS anymore. Even in the OS packages, they probably won't change anything on their own due to the age of their whole system.
If you really want/have to use Ruby on Red Hat 5, you probably need to get another source for it that the RPMs provided by the OS, e.g. rbenv / ruby-build or ruby-install or even rvm. You should use a newer Ruby version, i.e. a 2.1 or 2.2 version. All Ruby versions < 2.0 are unsupported by the language developers by now.
Alternatively, you should try to use a newer version of RedHat, i.e. RedHat 7 which doesn't need to support to 8 year old software...
Suspicious here is that yum installed ruby 1.8 which is pretty outdated version, it seems you have two versions of ruby on your system now and gem tries to use the old one.
Check the version of the package installed recently and try to force rubygems to use the new version(by removing the old ruby or linking to the path returned by which ruby)

RubyMine 5.4 does not see 1.9.3 ruby

Using RubyMine as my IDE for ruby development with chef on a mbp running OSX 10.8.4
Chef requires ruby 1.9 ruby, and I have it installed. When querying the ruby version via terminal it does shows : ruby 1.9.3p429 . However, when trying to use it with RubyMine, it shows (Under preferences->SDKs) only 1.8.3, not seeing or allowing me to change to 1.9.x
Any help greatly appreciated!.
Thank you.
So apparently version 1.8.3 is installed at /usr/bin/ruby. How did you install 1.9?
If you are using RVM then your ruby installations are probably at ~/.rvm/rubies/ instead. Or if you're using rbenv, ruby might be at ~/.rbenv. Although RubyMine should detect the default location for rvm and rbenv. Do you have ruby in another location? Maybe check with sudo find -name ruby in the terminal to look for other locations of ruby.

Is Ruby 1.9.3 supported on Mac OS? Or should I stick to 1.8.7?

Is Ruby 1.9.3 supported on Mac OS? Or should I stick to 1.8.7? I am new to OS X and am setting up my Ruby development environment.
Technically speaking, no. So I'm +1ing your question which currently has two downvotes.
According to the Ruby's wiki page on Supported Platforms, OS X is not "Supported", but is merely "Best Effort" for both Ruby 1.9.3, and Ruby 1.9.1. Ruby 1.9.3 has no "Supported" platforms, and Ruby 1.9.1 only has Debian GNU/Linux 4.0 on IA32 supported.
However, Ruby 1.8.7 will soon reach its end of life as far as the MRI Ruby team is concerned, and I wouldn't count on Apple doing much maintenance of Ruby 1.8.7. So use 1.9.3 anyway.
Yes.
You can install it from source or with Homebrew, or use rbenv or RVM to manage multiple Ruby versions.
I upvoted as well. This is a good question.
I run Ruby 1.9.3 for almost all my development work. I'd highly recommend using it.
Ruby 1.8.7 is older, slower and is running out of time for support.
I'd also recommend doing all installation of Ruby on your machine using RVM (The Ruby Version Manager). Here's the link to install it:
https://rvm.io//rvm/install/
Once you have RVM installed (the steps on its web page are good), then type the following to install Ruby 1.9.3:
rvm install ruby-1.9.3-p125
This will bring the latest version of Ruby 1.9.3 down and install it on your machine for you.

Ruby upgrade from 1.8.5 to 1.8.7 and make all programs understand to use the newer version

Here is a question related to Ruby.
The Express Installation of OpenNebula 2.2.0 on CentOS has caused me big problems, since it installs Ruby 1.8.5, which is incompatible with Sunstone.
I installed Ruby 1.9.2 after executing the Express installation, but the problem remained, since Sunstone tried to use the old Ruby-installation.
I don't know how to configure, so that the newer Ruby-version should be used instead.
After this problem I reinstalled CentOS and installad Ruby 1.8.7.
When I do ruby -v, it shows:
ruby 1.8.7 (2010-12-23 patchlevel 330).
But when I do 'gem update –system', it says
(Gem::InstallError)
rubygems-update requries Ruby Version >= 1.8.7.. An older version was installed before from the CentOS-repository (for yum install) and apparently the GEM install doesn't understand that I have installed a newer version.
So my question is:
How should I configure my system so that all programs will understand to use Ruby 1.8.7 ?
Thanks!
Anders Branderud
I suggest to try using Ruby Version Manager
bash < <(curl -s https://rvm.ioinstall/rvm)
and then, or even better before :), read some documentation about rvm.

update ruby to 1.8.7

I'm working on a project that i have to use ruby 1.8.7. I'm using today, ruby 1.8.6 + Mac OSX Darwin. This ruby 1.8.6 was installed with the OS, it's a developer package from Apple. My question is: how can i update this package? if i run ports, it dont find my current installed package and install a new ruby version, with different paths and as effect it breaks my rubygems (i know how to fix it, but it is always workarounds over workarounds).
There is a clean way to update the default ruby that comes with the OS or its better to remove it and just manage it by Port? Please answer like this one How to update to Ruby 1.8.7 don't helps me
Have you tried rvm gem? It manages Ruby versions installed, allow to compile most (if not all) actual (and archival) Ruby versions, sets proper environment variables pointing to actually used ruby version.
$ gem install rvm
$ rvm install 1.8.7
$ rvm use 1.8.7 --default
On my OS X machines I have several versions of Ruby installed.
I install then, from source, under /usr/local/ruby-1.X.X
Once you have multiple versions of Ruby installed you will need your environment to know which one to use.
I do this by setting the PATH, like so
export PATH="/usr/local/ruby-1.8.7/bin:$PATH";
See Hive Logic's article on installing Ruby

Resources