Problems Downgrading Ruby on OS X Mavericks

OS X 10.9 ships with ruby ​​2.0.0p195, but I need to install Ruby 1.8.7. I constantly encounter errors. I have Xcode5-DP installed, and I believe the command line tools are also installed.

In terminal:

sudo rvm install 1.8.7 Searching for binary rubies, this might take some time. No binary rubies available for: osx/10/x86_64/ruby-1.8.7-p371. Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies. Installing requirements for osx, might require sudo password. Certificates in '/usr/local/etc/openssl/cert.pem' already are up to date. Installing Ruby from source to: /Users/alextoul/.rvm/rubies/ruby-1.8.7-p371, this may take a while depending on your cpu(s)... ruby-1.8.7-p371 - #downloading ruby-1.8.7-p371, this may take a while depending on your connection... ruby-1.8.7-p371 - #extracted to /Users/alextoul/.rvm/src/ruby-1.8.7-p371 (already extracted) Patch stdout-rouge-fix was already applied. Patch no_sslv2 was already applied. ruby-1.8.7-p371 - #configuring... Error running 'env CFLAGS=-O3 -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libxml2/include -I/usr/local/opt/libxslt/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl098/include LDFLAGS=-L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libxml2/lib -L/usr/local/opt/libxslt/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl098/lib ./configure --prefix=/Users/alextoul/.rvm/rubies/ruby-1.8.7-p371 --disable-install-doc --without-tcl --without-tk --enable-shared', please read /Users/alextoul/.rvm/log/ruby-1.8.7-p371/1371228839_configure.log There has been an error while running configure. Halting the installation. 

1371228839_configure.log says:

 ./configure configure: WARNING: unrecognized options: --without-tcl, --without-tk checking build system type... i686-apple-darwin13.0.0 checking host system type... i686-apple-darwin13.0.0 checking target system type... i686-apple-darwin13.0.0 checking whether the C compiler works... no configure: error: in `/Users/alextoul/.rvm/src/ruby-1.8.7-p371': configure: error: C compiler cannot create executables See `config.log' for more details 

Other (useful) information:

 ruby -v > ruby 2.0.0p195 (2013-05-14 revision 40734) [universal.x86_64-darwin13] brew update > Already up-to-date. gcc --version > Configured with: --prefix=/Applications/Xcode5-DP.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode5-DP.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 > Apple LLVM version 5.0 (clang-500.1.58) (based on LLVM 3.3svn) > Target: x86_64-apple-darwin13.0.0 > Thread model: posix sudo rvm requirements > Installing requirements for osx, might require sudo password. > Certificates in '/usr/local/etc/openssl/cert.pem' already are up to date. 

Thank you for your help.

+6
source share
5 answers

10.9 is an early beta version of the OS. [Edit: note the response date in July 2013] If I were running 10.9, I would assume that I would have to reinstall the operating system from scratch at least 2 times. (At least once during the beta cycle, because, well, it's beta, and once, when 10.9 comes out in the general release, because, well, beta).

Given this, I propose four courses of action (choose 1 or many):

  • Work with the RVM guys and dig 10.9, possibly by changing the compiler environment and get Ruby 1.8.7 compilation. This is more complicated because technically this material is under the NDA.
  • Instead, configure the virtual machine and run Ruby 1.8.7 on the virtual machine. Bonus points for using Vagrant and Chef / Puppet, because you may need to rebuild the virtual machine. (Just save the Vagrantfile and Puppet or Chef configuration files to Github / Dropbox / whatever so you can clone them and rebuild your virtual machine from scratch.)
  • OR just reboot to 10.8 to get production work. 10.8 is the OS level at the production level, 10.9 should be treated with caution - it can eat your work. It really should not be used for production purposes (aka: daily Ruby code entry). If you write a 10.9 application only in Cocoa / Objective-C (or update RubyMotion or something else), it may be different (but I still keep good backups and be careful about them).
  • Work on updating the code base for Ruby 2.0, as Ruby 1.8.7 is no longer officially supported.

Edit (October 24, 2013): If you are here because you just installed Mavericks (released October 22, 2013), you want Ruby 1.8.7 to work a few days after this release, and RVM does not work for you (because you are impatient and cannot wait), here is what you can do (which should work, although I am not an rbenv user):

  • Use macports to install port install ruby . This is Ruby 1.8.7. This compilation worked for me on my Mavericks machine (although you will need to install Macports from the source when writing this and install the command line development tools even if you have Xcode 5 installed. Yes, really).
  • Now install rbenv .
  • /opt/local/bin/ruby1.8 in the ~/.rbenv/versions/ folder. In particular ~/.rbenv/versions/ruby-1.8.7-p374
  • Read the rbenv documentation, but it should work now! (At least from the documentation. Again, not a rbenv user, but play it on TV).

I'm sure you can do this with homebrew too, but I know that Ruby 1.8.7 installs the latest versions of Macports correctly, because that is what I use (and it just installed cleanly for me).

+13
source

When you see this error message:

configure: error: C compiler cannot create executable files :

First of all, be sure to update your command line tools:

 $ xcode-select --install 

Now Apple wants you to agree to their license before using these tools:

 $ gcc Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo. $ sudo gcc You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode. [...] 

Once you accept it, the command line tools will work as expected.

+10
source

If you installed the developer tools on OS X, then Mavericks Ruby 1.8 is already installed with 2.0. So, all you have to do is switch the symbolic link "Current" to point to the 1.8 directory.

 #Install Xcode Developer tools xcode-select --install #Delete Current symbolic link to Ruby 2.0 sudo rm /System/Library/Frameworks/Ruby.framework/Versions/Current #Create new Current symbolic link to Ruby 1.8 sudo ln -s /System/Library/Frameworks/Ruby.framework/Versions/1.8 /System/Library/Frameworks/Ruby.framework/Versions/Current #Check Ruby version is 1.8.7 ruby -v 
+8
source

Try this (make sure the dev toolchain is reachable):

 $ sudo xcode-select -s /Applications/Xcode5-DP.app/Contents/Developer 

Then try again.

+3
source

Try switching your compiler

 rvm install 1.8.7 --with-gcc=clang 
0
source

Source: https://habr.com/ru/post/947321/


All Articles