On Apple Silicon: ruby-build: definition not found: 3.0.0 - ruby

When I try to install the latest ruby (3.0.0), it fails with:
ruby-build: definition not found: 3.0.0
Clearly, ruby 3 has been released more than a month ago, so I'm guessing the team is running into problems building/packaging it for Apple Silicon (M1) or no one's had the bandwidth to do so yet. How would I follow up on this?

ASDF users, try asdf plugin update ruby then asdf install ruby the_ruby_version_here

Have you tried brew update && brew upgrade rbenv ruby-build? That may help you get the latest available version of Ruby. You can try rbenv install --list to see what you have available.

Related

Unable to use Sass on macOS Catalina

Since upgrading to Catalina I'm not being able to use Ruby Sass. I tried installing Node Sass but I keep getting this message:
dyld: Library not loaded: /Users/luiscarlospandocarrera/.rvm/rubies/ruby-2.5.0/lib/libruby.2.5.dylib
Referenced from: /Users/luiscarlospando/.rvm/rubies/ruby-2.5.0/bin/ruby
I tried uninstalling Ruby Sass, reinstalling it and I just keep getting this message.
What would I need to do?
Thanks in advance!
This looks like a Ruby problem, so maybe reinstall Ruby, or possibly bump to a newer version to see if that side-steps the issue. 2.7.0 is out and worth a shot. From time to time an OS upgrade will pull a library your locally built Ruby depends on, so you need to rebuild Ruby to link to the new, updated libraries.
Ruby SASS is EOL (26 March 2019) - https://sass-lang.com/ruby-sass and you should try to find other ways to "compile" your SASS files.
I uses sassc with PHPStorm as a runner for the themes that uses SASS.
Easiest way to install is by using homebrew:
brew install sassc
You should also consider using https://github.com/sass/dart-sass
I managed to solve this problem by installing the latest version of Ruby as suggested by tadman by using Ruby Version Manager (rvm).
To do it I did the following steps:
Installed the latest version of rvm:
curl -L https://get.rvm.io | bash -s stable and then I had to restart the terminal.
Installed the latest version of Ruby:
rvm install ruby-2.7.0
I did set v2.7.0 as the version of Ruby I wanted to use:
rvm --default use ruby-2.7.0
I hope this helps!

Fix for: Prior to 0.1.6, libyaml is vulnerable to a heap overflow exploit from malicious YAML payloads

I get the following error when running rspec after I added the vcr gem. Simply running gem install psych -- --enable-bundled-libyaml as suggested doesn't solve the problem. I am using rbenv and ruby-build and I am on ruby 2.1.1. What do i have to do to fix this?
SafeYAML Warning
----------------
You appear to have an outdated version of libyaml (0.1.4) installed on your system.
Prior to 0.1.6, libyaml is vulnerable to a heap overflow exploit from malicious YAML payloads.
For more info, see:
https://www.ruby-lang.org/en/news/2014/03/29/heap-overflow-in-yaml-uri-escape-parsing-cve-2014-2525/
The easiest thing to do right now is probably to update Psych to the latest version and enable
the 'bundled-libyaml' option, which will install a vendored libyaml with the vulnerability patched:
gem install psych -- --enable-bundled-libyaml
First, you have to update Ruby-build, they have recently patched this security issue. Now, it installs libyaml 0.1.6 to compile Ruby.
$ rm -rf ~/.rbenv/plugins/ruby-build
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
Recompile, reinstall the Ruby version you are using, 2.0.0-p451 in my case:
$ rbenv install 2.0.0-p451
rbenv: /home/ubuntu/.rbenv/versions/2.0.0-p451 already exists
continue with installation? (y/N) y
Downloading yaml-0.1.6.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/5fe00cda18ca5daeb43762b80c38e06e
...
And it worked in my case.
I just followed the instructions in this reply https://stackoverflow.com/a/9510209/816002 and it seems to have done the trick. I did it slightly different however:
rvm pkg install libyaml
rvm get stable
rvm reinstall all --force
This might not help if you are using system Ruby, and will obviously be different with rbenv.
As a user of rvm, I managed to get my set up to play ball by building 0.1.6 release of libyaml, then (re)installing Ruby, passing the following configure flag
rvm install 1.9.3 -- --with-libyaml-dir=/usr/local
Hope this helps people in the short-term until the dust settles.
If you're on Mac OS X / Mavericks then you may be running on the system-installed Ruby. Thoughbot encourages you not to do this. I was having this problem as well, so I followed their advice and installed brew and rbenv and the problem went away.
For rvm this worked for me:
rvm pkg install libyaml
$LIBYAML_PATH will be the path where RVM installs the upated yaml
rvm get stable
rvm reinstall all --force --with-libyaml-dir=$LIBYAML_PATH
http://synaptian.com/2014/04/fixing-the-safeyaml-warning-on-ubuntu-12-04-with-rvm/

Why can I not install ruby 1.9.3-p488 via homebrew?

I already have ruby version 2.0 but for a project, I need version 1.9.3-p448. When I try to run the ruby build I get the following:
ruby-build: definition not found: 1.9.3-p448
You can list all available versions with `rbenv install --list'.
If the version you're looking for is not present, first try upgrading
ruby-build. If it's still missing, open a request on the ruby-build
issue tracker: https://github.com/sstephenson/ruby-build/issues
The highest 1.9.3 version that comes up when i run rbenv install --list is 1.9.3-p429 and I can't figure out how to do a manual install. All of the documentation I have read only has instructions from the start but nowhere addresses this issue.
I had a similar problem and I uninstalled ruby build then reinstalled it and it worked. Hope that works!
You need to upgrade rbenv. 1.9.3-p448 is available in the current version.

rvm determine and install latest version of ruby

So far I only know how to do commands like
rvm 2.0.0
Fortunately Google tells me
The current stable version is 2.0.0-p247.
But shouldn't I be able to use rvm to do that step for me? I can't figure out how to just tell rvm to install the latest version of ruby, without manually specifying it.
it is enough to:
rvm get stable
rvm use ruby --install --default
it will update rvm, check for latest ruby - install it if missing - and set as default
I don't know of a way to have rvm just install the latest version automatically, but here's three simple commands using just rvm:
rvm reload
rvm list known # This will show all the available versions, including the latest
rvm install <latest_version> # Replace <latest_version> with the latest shown by the last command
rvm install ruby-head should install the last known version.

Getting Ruby 1.8.7 installed on Mountain Lion (10.8)

I'm having a lot of trouble getting Ruby 1.8.7 installed on my clean install of Mountain Lion. I've looked around on Stack Overflow and don't see anything that specifically addresses this issue and hope that someone might have encountered this before.
I'm using the command line tools that can be downloaded with Xcode
I haven't had any problems installing Ruby 1.9.3 via RVM and HomeBrew. When I try to install 1.8.7 I get the following message after it tries to compile:
I first ran the command
rvm install 1.8.7
This gave me this error
The provided compiler '/usr/bin/gcc' is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`.
After digging around a bit I tried
rvm install 1.8.7 --with-gcc=clang
Error running 'make ', please read /Users/paulzaich/.rvm/log/ruby-1.8.7-p370/make.log
There has been an error while running make. Halting the installation.
Ruby 'ruby-1.8.7-p370' was built using clang - but it's not (fully) supported, expect errors.
Please be aware that you just installed a ruby that requires 2 patches just to be compiled on up to date linux system.
This may have known and unaccounted for security vulnerabilities.
Please consider upgrading to Ruby 1.9.3-194 which will have all of the latest security patches.
At this point I did some more searching and found something about needing compile my own readline. RVM Does Not Install Ruby 1.9.2 on Snow Leopard: 'Error running 'make '
This unfortunately seemed to corrupt my entire rvm install including 1.9.3. I tried to reinstall 1.9.3 and got the same errors I as I was getting with 1.8.7. I completely deleted RVM at this point and reinstalled. Had no problem installing 1.9.3 again.
I also tried updating all versions of rvm based off of this post RVM issue with Mountain Lion. No luck there either.
Update: I also tried using this walkthrough for REE 1.8.7 which recommended installing gcc-4.2. No luck unfortunately.
Update 2: I reference rvm requirements and installed the following packages
brew update
brew tap homebrew/dupes
brew install autoconf automake apple-gcc42
rvm pkg install openssl
So far so good. Then I referenced this post on needing to reference the GCC compiler. I determined that the links referenced might not be correct because I'm using homebrew? I found the compiler in my Cellar folder and used the following command
CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 rvm install 1.8.7
No luck. Same error messages as before.
I just figured it out! Please reference this question on SO
rvm can no longer install 1.8.7-p352 on Mac OS X Mountain Lion
rvm reinstall 1.8.7 --without-tcl --without-tk
Alternatively, try this installation order if you have Homebrew.
brew install tcl-tk
rvm reinstall 1.8.7
Just to follow up to Paul's post. I'm running OSX 10.8.2, had 1.9.3 install without issues, but 1.8.7-p370 also failed. I symlinked gcc-4.2:
sudo ln -s /usr/local/bin/gcc-4.2 /usr/bin/gcc-4.2
...successfully ran:
brew install tcl
...but tk failed:
brewk install tk
If you're in the same spot, this command did the trick:
CC=/usr/local/bin/gcc-4.2 rvm reinstall 1.8.7 --without-tk
Latest Xcode provides only clang - not GNU gcc, you need to install gcc-4.2 to be able to compile Ruby 1.8.7 properly, following command will show available options:
rvm requirements
currently only ruby 1.9.3-p125 and later has limited support for clang, but this is limited support, and still errors can be found.

Resources