How to replace/update an old version of Ruby - ruby

Mavericks 10.9.1
I'm have difficulty updating ruby 1.9.3p194
rvm install 2.1.0
Searching for binary rubies, this might take some time.
Found remote file https://rvm.io/binaries/osx/10.9/x86_64/ruby-2.1.0.tar.bz2
Checking requirements for smf.
SMF Framework support is only intended for RailsInstaller / Tokaido.app, please use Macports / Homebrew integration instead.
Requirements installation failed with status: 100.
I've tried Homebrew but this doesn't work either. Doctor reveals a number of issues. Can anyone help?

Related

Can't install ruby 1.8.7 Mac OS X Sierra

I'm trying to (re-)install ruby 1.8.7 using rvm 1.29.1 on a brand new MBP running OS X Sierra. I HAVE to get this done for work, I'm not in a position to switch to a more current version or anything unfortunately.
I had a functional install of this but after getting some weird errors in a project decided to try a completely clean reinstall of both rvm (and eventually homebrew!) (long story- had a broken file structure after removing an unwanted space from the name of my home directory!). I was careful to remove all traces of the old install from .bashrc, .profile etc following other posts on here. 2.4.0 installs and runs fine. However, on trying to install 1.8.7:
9bxbniv1:~ Rob$ rvm install ruby-1.8.7
Warning! Requested ruby installation which requires another ruby available - installing ruby-1.8.7-p374 first.
ruby-1.8.7-p374 - #removing src/ruby-1.8.7-p374..
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl#1.1/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/Rob/.rvm/rubies/ruby-1.8.7-p374, this may take a while depending on your cpu(s)...
ruby-1.8.7-p374 - #downloading ruby-1.8.7-p374, this may take a while depending on your connection...
ruby-1.8.7-p374 - #extracting ruby-1.8.7-p374 to /Users/Rob/.rvm/src/ruby-1.8.7-p374....
ruby-1.8.7-p374 - #applying patch /Users/Rob/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch.
ruby-1.8.7-p374 - #applying patch /Users/Rob/.rvm/patches/ruby/1.8.7/no_sslv2.diff.
ruby-1.8.7-p374 - #applying patch /Users/Rob/.rvm/patches/ruby/GH-488.patch.
ruby-1.8.7-p374 - #applying patch /Users/Rob/.rvm/patches/ruby/ssl_no_ec2m.patch.
ruby-1.8.7-p374 - #configuring...............................
ruby-1.8.7-p374 - #post-configuration.
ruby-1.8.7-p374 - #compiling................................
Error running '__rvm_make -j 1',
showing last 15 lines of /Users/Rob/.rvm/log/1488471654_ruby-1.8.7-p374/make.log
^
openssl_missing.c:107:28: error: dereferencing pointer to incomplete type
EVP_MD_CTX_cleanup(&ctx->o_ctx);
^
openssl_missing.c:108:28: error: dereferencing pointer to incomplete type
EVP_MD_CTX_cleanup(&ctx->md_ctx);
^
In file included from /usr/include/string.h:192:0,
from openssl_missing.c:19:
openssl_missing.c:109:27: error: invalid application of 'sizeof' to incomplete type 'HMAC_CTX'
memset(ctx, 0, sizeof(HMAC_CTX));
^
make[1]: *** [openssl_missing.o] Error 1
make: *** [all] Error 1
+++ return 2
There has been an error while running make. Halting the installation.
To proceed rvm requires a ruby-1.8.7-p374 compatible ruby is installed.
We attempted to install it automatically but it failed with status 2.
Please install it manually (or a compatible alternative) to proceed.
I have tried some of the hacks suggested in Getting Ruby 1.8.7 installed on Mountain Lion (10.8) but unfortunately that didn't help.
Looking further into the log file the error begins with the following message:
In file included from openssl_missing.c:22:0:
openssl_missing.h:79:35: error: macro "EVP_MD_CTX_create" passed 1 arguments, but takes just 0
EVP_MD_CTX *EVP_MD_CTX_create(void);
^
In file included from /usr/local/opt/openssl#1.1/include/openssl/x509.h:23:0,
from /usr/local/opt/openssl#1.1/include/openssl/x509_vfy.h:17,
from openssl_missing.c:16:
/usr/local/opt/openssl#1.1/include/openssl/evp.h:501:51: error: expected declaration specifiers or '...' before '(' token
# define EVP_MD_CTX_init(ctx) EVP_MD_CTX_reset((ctx))
Searching for the first line of this error returned 0 results on here. Suggestions would be gratefully received.
I was able to get this working via RVM using a variant of rbenv code I found # https://gist.github.com/davidkellis/909449e13905d8bfbd49c30d20f7fbca . I already had xcode and openssl.
rvm install 1.8.7 --with-openssl-dir=`brew --prefix openssl`
The latest development version of RVM should work:
rvm get head
I also updated XCode to version 8.2.1 before I upgraded RVM, if you do upgrade XCode you'll need to launch it and agree the new license or:
sudo xcodebuild -license
I had to upgrade my brew as well and do loads to get it working as it hadn't been touched for a very long time.
I'm not sure if you could just do one in isolation. Mine is up and running now.
I nuked my RVM as I had let it get out of hand. Wish I had just pruned it instead. Now to get the legacy Rails apps up and running.
Ruby 1.8.7 is dead and no longer supported on any modern macOS, so you can't install it. That version of Ruby is a historical artifact at this point, and if you really, really do need to run it, you'll either need to get a historical version of OS X, Linux or BSD which is compatible with it.
My advice is to use Vagrant to build a virtual machine that has an older version of Linux or BSD which can be used to build Ruby 1.8.7. Anything dating from 2010 or earlier will probably work, so Ubuntu 10.04 might be a good place to start.
It's worth noting that Ruby Enterprise Edition is a variant of 1.8.7 that was supported longer than MRI 1.8.7 was, so you may have more success with that version. It was discontinued in 2012.
I ended up restoring my system using time machine. But another colleague had the same problems setting things up on a new machine, and found
rvm install ruby -v 1.8.7--autolibs=enable
helpful, if anyone else stumbles across this.

Can I upgrade to the current version of Ruby (2.2.3) on OS X v10.6.8?

I'm looking at "Install Ruby on Rails · Mac OS X Yosemite", and in the instructions it says to update your OS which I don't really want to do because my computer is getting old.
I also found "How to update Ruby to 1.9.x on Mac?". As far as I can tell, I don't have RVM and I'm afraid of yet another install, in case my system requirements still aren't good enough.
Ultimately, I'm trying to update Jekyll, but I need to update my system a little bit first. I need Ruby 1.9.3 or later. Will "How to update Ruby to 1.9.x on Mac?" work? I'm running Ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin10.0]'.
EDIT: I did end up getting RVM installed. For those who find this page in the future, I ran into these issues/help pages:
How to resolve "gpg: command not found" error during RVM installation?
OS X Mavericks install rvm WARNING * WARNING: You have '~/.profile' file...
RVM installation missing $PATH * WARNING: Above files containsPATH=with no$PATHinside
I suggest that you use RVM to install Ruby.
curl -sSL https://get.rvm.io | bash -s stable --ruby
You need to restart the terminal in order to run rvm:
rvm install 2.2
rvm use 2.2 --default
This is what worked for me
\curl -sSL https://get.rvm.io | bash -s stable --ruby
For the most up-to-date info on how to do this, check this documentation.
You do not need the latest version of OSX to run an updated version of Ruby. Whether or not you need something more current than 10.6.8 to run 2.2.3 I cannot tell. But 1.9.3 should build just fine and 2.2.3 likely will as well.
Using rvm (or rbenv, or ruby-build, or whatever) is certainly an option if you are simply doing development. Then you can have multiple ruby versions at your command without having to disturb the system ruby. Be aware these are not a panacea. Each has its own complexities and egocentricities. Go to the project websites and read the documentation carefully or you can easily get betrayed by your assumptions about how things 'should' work.
All of ruby version managers should install on any version of OSX that supports the build tools required by the Ruby that you want to host. However, be aware you will need installed the OSX xcode application for your system (available free from the Apple App Store but you need an account) and you will need the optional command line tools for xcode as well (also from the App Store).
If you want to update the system ruby then take a look at either the homebrew or macports projects. These provide up to date versions of many, many linux projects for OSX, including Ruby (and git). You will need to meet the same xcode requirements. A build is a build wherever the binaries end up.
The system from which I am writing this answer once ran Snow Leopard and I had at least Ruby 1.9 dot something installed on it via Ports. I am currently paused at 10.9.5 and am running:
ruby --version
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin13]
Without any problems.
In case anyone bumps into the same error I did: “Requirements installation failed with status: 1.”, you need to install homebrew.
Use this:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

rvm and octopress cannot generate gists and pictures under mac

Since I installed octopress I can not run rake generate for posts that include pictures, code or other media. I get all kind of errors.
I'm using rvm's ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.0.0] under Mountain Lion. As a package manager I use MacPorts. Is there anything I need to install or that I can do to fix this? It's getting really annoying... :-(
Thanks in advance, right bellow you can see the log here. I wasn't able to post it on stackoverflow.
Thanks in advance for your time!
It looks like you used clang for compiling ruby, this is not fully supported. There is at least one known bug with Fibers, and others problems might happen depending on clang version.
Ruby should be compiled with GNU GCC - you can find instructions how to get it by reading output of:
rvm requirements
There is also slightly chance this could be OpenSSL related, make sure you have only one version of it installed and used, sometimes reinstalling it with RVM could help:
rvm pkg install openssl
rvm reinstall 1.9.3

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.

How to update Ruby to 1.9.x on Mac?

I have created a new user account on my mac and I am trying to update to the current version of ruby on it (1.9.2) from the snow leopard default of 1.8.7. Can somebody point me to tutorial or explain the best method to update Ruby on my mac from 1.8 to 1.9.2? Thanks
As The Tin Man suggests (above) RVM (Ruby Version Manager) is the Standard for upgrading your Ruby installation on OSX: https://rvm.io
To get started, open a Terminal Window and issue the following command:
\curl -L https://get.rvm.io | bash -s stable --ruby
( you will need to trust the RVM Dev Team that the command is not malicious - if you're a paranoid penguin like me, you can always go read the source: https://github.com/wayneeseguin/rvm ) When it's complete you need to restart the terminal to get the rvm command working.
rvm list known
( shows you the latest available versions of Ruby )
rvm install ruby-2.3.1
For a specific version, followed by
rvm use ruby-2.3.1
or if you just want the latest (current) version:
rvm install current && rvm use current
( installs the current stable release - at time of writing ruby-2.3.1 - please update this wiki when new versions released )
Note on Compiling Ruby: In my case I also had to install Homebrew Link to get the gems I needed (RSpec) which in turn forces you to install Xcode (if you haven't already) https://itunes.apple.com/us/app/xcode/id497799835 AND/OR install the GCC package from: https://github.com/kennethreitz/osx-gcc-installer to avoid errors running "make".
Edit: As of Mavericks you can choose to install only the Xcode command line tools instead of the whole Xcode package, which comes with gcc and lots of other things you might need for building packages. It can be installed by running xcode-select --install and following the on-screen prompt.
Examples: https://rvm.io/workflow/examples/
Screencast: http://screencasts.org/episodes/how-to-use-rvm
Note on erros: if you get the error "RVM is not a function" while trying this command,
visit: How do I change my Ruby version using RVM? for the solution.
I'll make a strong suggestion for rvm.
It's a great way to manage multiple Rubies and gems sets without colliding with the system version.
I'll add that now (4/2/2013), I use rbenv a lot, because my needs are simple. RVM is great, but it's got a lot of capability I never need, so I have it on some machines and rbenv on my desktop and laptop. It's worth checking out both and seeing which works best for your needs.
With brew this is a one-liner:
(assuming that you have tapped homebrew/versions, which can be done by running brew tap homebrew/versions)
brew install ruby193
Worked out of the box for me on OS X 10.8.4. Or if you want 2.0, you just brew install ruby
More generally, brew search ruby shows you the different repos available, and if you want to get really specific you can use brew versions ruby and checkout a specific version instead.
I know it's an older post, but i wanna add some extra informations about that.
Firstly, i think that rvm does great BUT it wasn't updating ruby from my system (MAC OS Yosemite).
What rvmwas doing : installing to another location and setting up the path there to my environment variable ... And i was kinda bored, because i had two ruby now on my system.
So to fix that, i uninstalled the rvm, then used the Homebrew package manager available here and installed ruby throw terminal command by doing brew install ruby.
And then, everything was working perfectly !
The ruby from my system was updated !
Hope it will help for the next adventurers !
I'll disagree with The Tin Man here. I regard rbenv as preferable to RVM. rbenv doesn't interfere drastically with your shell the way RVM does, and it lets you add separate Ruby installations in ordinary folders that you can examine directly. It allows you to compile Ruby yourself. Good outline of the differences here: https://github.com/sstephenson/rbenv/wiki/Why-rbenv%3F
I provide instructions for compiling Ruby 1.9 for rbenv here. Further, more detailed information here. I have used this technique with easy success on Snow Leopard, Lion, and Mountain Lion.
Dan Benjamin's Hivelogic article Installing Ruby, RubyGems, and Rails on Snow Leopard is the recommended place to go although the article is for 1.8, so here's a Ruby 1.9-specific install on Snow Leopard. Watch out for the 64-bit thing... either go all 64-bit 'fat' (as is - for example - Apache on OS X, which can cause problems with 32-bit libraries) or check any gems you're likely to use to make sure they're okay for 64-bit.
This command actually works
\curl -L https://get.rvm.io | bash -s stable --ruby
As previously mentioned, the bundler version may be too high for your version of rails.
I ran into the same problem using Rails 3.0.1 which requires Bundler v1.0.0 - v1.0.22
Check your bundler version using: gem list bundler
If your bundler version is not within the appropriate range, I found this solution to work: rvm #global do gem uninstall bundler
Note: rvm is required for this solution... another case for why you should be using rvm in the first place.
There are several other version managers to consider, see for a few examples and one that's not listed there that I'll be giving a try soon is ch-ruby. I tried rbenv but had too many problems with it. RVM is my mainstay, though it sometimes has the odd problem (hence my wish to try ch-ruby when I get a chance). I wouldn't touch the system Ruby, as other things may rely on it.
I should add I've also compiled my own Ruby several times, and using the Hivelogic article (as Dave Everitt has suggested) is a good idea if you take that route.

Resources