Error installing 1.9.3 with RVM on Lion - ruby

I have burned an embarrassing number of hours trying to install ruby and rails on Mac.
I am using Lion 10.7.2, Xcode 4.2.1, rvm 1.10.0, and gcc 4.2.1
Does anyone have a surefire way to install ruby with rvm. Or, is there
rvm install 1.9.2 -C --with-readline-dir=$rvm_path/usr --with-iconv-dir=$rvm_path/usr
Produces the error
make[1]: *** [../../.ext/x86_64-darwin11.2.0/tcltklib.bundle] Error 1
make: *** [mkmain.sh] Error 1
Running
rvm install 1.9.3-p0 --with-gcc=clang
Produces the error
make: *** [.rbconfig.time] Abort trap: 6
Simply running
rvm install 1.9.3
Produces the error
make[2]: *** [../../.ext/x86_64-darwin11.2.0/tcltklib.bundle] Error 1
make[1]: *** [ext/tk/all] Error 2
make: *** [build-ext] Error 2
From reading this, I ran the below in the Terminal and my Mac would not restart until I put the libiconv.2.dylib back in place using Target Disk Mode.
rm /usr/local/lib/libiconv.2.dylib
ln -s /usr/lib/libiconv.2.dylib /usr/local/lib/libiconv.2.dylib
From this link, I also removed a previous install of Macfuse which is known to cause problems
I have reinstalled Xcode twice [Install Xcode from the Application Folder].
Is there another way to get Ruby Installed on Lion?
Many thanks as I'm fast running out of ideas
Graham

The following worked for me:
$ rvm install 1.9.3 --with-gcc=clang
I got that from this page.

I had this problem too and tried several of the listed solutions unsuccessfully. Then I downloaded XCode 4.3.1 for Lion and the Xcode command line tools update (dated March 7, 2012) from Apple's developer site and just re-ran 'rvm install 1.9.3'. Worked perfectly and installed 1.9.3p125.
Hope this helps

Note that RVM itself tells you that it won't work with XCode 4.2:
** Lion Users: DO NOT use Xcode Version 4.2.x for OS X Lion. It currently fails to build several rubies and gems,
as well as several Homebrew and Macports packages as well. Xcode Version 4.1 (4B110) works.
You can see this warning again by calling rvm requirements.
The simplest (albeit slow) way to fix the problem is to remove XCode 4.2 and download and install XCode 4.1. You can also apparently fix it with a separate gcc-4.2 installation, but I don't know the details of how you'd do that.
For more detail, see the full discussion on the rvm github tracker

I had a similar problem on my 10.7.2 server with Xcode 4.2.1. Installing this stand-alone gcc compiler (sourced from apple), did the trick for me.

You need to force autoconf.
rvm install 1.9.3 --force-autoconf

I was finally able to install ruby by using macports and Xcode 4.2.1. Had to abandon rvm.
port install ruby19 +nosuffix
Thanks for all of the answers and help :)

The following worked for me:
rvm pkg install iconv
rvm pkg install readline
rvm remove 1.9.3
rvm install 1.9.3 --with-iconv-dir=$rvm_path/usr --with-readline-dir=$rvm_path/usr
source: http://blog.merjis.com/2011/12/18/rails-3-1-ruby-1-9-3-lion-xcode-4-1/

Related

How can I install 1.9.3 version of ruby on Mac?

I use rvm install 1.9.3 to instal ruby, but I've got the following error.
Xcode version older than 4.6.2 installed, download and install newer version from:
http://connect.apple.com
After installation open Xcode, go to Downloads and install Command Line Tools.
Error running 'requirements_osx_brew_update_system ruby-1.9.3-p551', please read /Users/.rvm/log/1605112932_ruby-1.9.3-p551/update_system.log Requirements installation failed with status: 1.
My Xcode version is
/usr/bin/xcodebuild -version
Xcode 12.1
Build version 12A7403
So, I found this and tried
rvm install 1.9.3 --with-gcc=clang
But got the same mistake. Then I tried
rvm pkg install openssl
CC=/usr/local/bin/gcc-4.2 CPP=/usr/local/bin/cpp-4.2 CXX=/usr/local/bin/g++-4.2 rvm install 1.9.3 --with-openssl-dir=$rvm_path/usr
But when I use rvm pkg install openssl got
Error running '__rvm_make install',
please read /Users/.rvm/log/1605114992/openssl_make.install.log
This file is really huge, but the beginning is
[2020-11-11 20:18:55] __rvm_make
__rvm_make ()
{
\make "$#" || return $?
}
current path: /Users/.rvm/src/openssl-1.0.1i
GEM_HOME=/Users/.rvm/gems/ruby-2.0.0-p648
PATH=/usr/local/opt/coreutils/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/Users/.rvm/gems/ruby-2.0.0-p648/bin:/Users/.rvm/gems/ruby-2.0.0-p648#global/bin:/Users/.rvm/rubies/ruby-2.0.0-p648/bin:/usr/local/bin:/bin:/usr/sbin:/sbin:/Users/.rvm/bin:/usr/bin
GEM_PATH=/Users/.rvm/gems/ruby-2.0.0-p648:/Users/.rvm/gems/ruby-2.0.0-p648#global
command(2): __rvm_make install
+ make install
making all in crypto...
making all in crypto/objects...
make[2]: Nothing to be done for `all'.
making all in crypto/md4...
make[2]: Nothing to be done for `all'.
And the end of the file is
installing man3/err.3
installing man3/evp.3
installing man3/hmac.3
/bin/sh: /Users/.rvm/usr/ssl/man/man3/hmac.3: Too many levels of symbolic links
make: *** [install_docs] Error 1
+ return 2
And how to fix that I couldn't find. Can somebody help me?
Support for Ruby 1.9.3 ended in February 2015, over five and a half years ago, it was released in 2011, nine years ago; The Ruby 1.9 series was released in 2007, thirteen years ago. Ruby 1.9.3 does not support getting compiled with Clang, and it probably can't be compiled with modern versions of GCC either. It also cannot be linked against current versions of OpenSSL.
Getting Ruby 1.9.3 to compile on a current platform by hunting each and every one of the invariably dozens of errors will probably be very tedious.
If you want to compile software that is that old, the easiest way is to do that, is to do it on the OS version that it was actually tested on. In your case, that would probably be MacOS X 10.7 "Lion".

Ruby Gem install Json fails on Mavericks and Xcode 5.1 - unknown argument: '-multiply_definedsuppress'

I was trying run gem install json and got the following error
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
linking shared-object json/ext/generator.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [generator.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /opt/boxen/repo/.bundle/ruby/2.0.0/gems/json-1.8.0 for inspection.
Results logged to /opt/boxen/repo/.bundle/ruby/2.0.0/extensions/universal-darwin-13/2.0.0/json-1.8.0/gem_make.out
I'm using:
Os X: 10.9.2
Xcode: 5.1 Build version 5B130a
Command Line Tools (CLT): 5.1.0.0.1.1393561416
Ruby: ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
Ruby Gem: 2.2.2
GCC: 4.2.1 Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
I am encountering the exact same problem after updating Xcode to 5.1 and news from Apple aren't good. From Xcode 5.1 Release Notes:
The Apple LLVM compiler in Xcode 5.1 treats unrecognized command-line options as errors. This issue has been seen when building both Python native extensions and Ruby Gems, where some invalid compiler options are currently specified.
Projects using invalid compiler options will need to be changed to remove those options. To help ease that transition, the compiler will temporarily accept an option to downgrade the error to a warning:
-Wno-error=unused-command-line-argument-hard-error-in-future
To workaround this issue, set the ARCHFLAGS environment variable to downgrade the error to a warning.
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install GemName
It seems that all gems violating the compiler options must be updated to use valid options. It is explicitly stated that: This option [downgrading error to warning] will not be supported in the future.
The clang note we are seeing (this will be a hard error (cannot be downgraded to a warning) in the future) corresponds to the change announced in the release notes.
To answer your question specifically, use the following to install the json gem:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install json
Note, however, that this is only a temporary fix.
One-liner to fix that
curl https://gist.githubusercontent.com/Paulche/9713531/raw/1e57fbb440d36ca5607d1739cc6151f373b234b6/gistfile1.txt | sudo patch /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb
To address the issue you can install the most recent version of ruby as described by #Sash. You can use the following commands to do so. In case you already have installed rvm, you don't need to reinstall it.
#Install rvm
\curl -sSL https://get.rvm.io | bash -s stable
#Install ruby version 2.0.0-p451
rvm install ruby-2.0.0-p451
#Print ruby version to verify that it was installed successfully
ruby -v
#Install json gem
sudo gem install json
Issue already addressed by Ruby:
https://bugs.ruby-lang.org/issues/9624
now we just need to wait for Apple to update their ruby version (2.0.0p247) to the one after the latest one (2.0.0p451) which hasn't come out yet ...
(or brew/macport it)
Update (2014-05-15): Mavericks 10.9.3 updates ruby to
ruby 2.0.0p451 (2014-02-24 revision 45167) [universal.x86_64-darwin13]
And this seems to resolves the issue.
#Muncken has already provided an answer to install gem one by one:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install GemName
Base on Muncken's answer, I've tried that it also works when using bundle install
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future bundle install
In my case, I actually have similar problem, but not on the system ruby, but on rubies installed by rvm from OSX 10.8, and it has issues after upgrading to OSX 10.9.
A simple reinstall works: rvm reinstall ruby-2.1.1
On OSX 10.10, I had several issues when running rails new firstapp such as:
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
fatal error: 'ruby/config.h' file not found
I updated rvm with this configuration and all the errors are gone!:
rvm get stable --auto-dotfiles
You can tell from the app name that I just started fiddling with Ruby on Rails, so the above advice may or may not work for you.
Paul Chechetin's one-liner doesn't appear to work anymore (9/21/15). However, this reply to the post mentioned in Pete's reply solved the problem for me:
(a) Install Apple's XCode, then (b) launch it and accept the licensing terms (I had done (a), but not (b).)
sudo gem uninstall compass
sudo gem install compass
None of these worked for me.
What finally worked is running the command with a sudo -
gem install byebug -v '9.0.6'
It's been a while and I've got similar error. An alternative to folks using bundler is to add the flag to the build configuration like below example:
bundle config build.<gemname> --with-cflags="-Wno-error=implicit-function-declaration"
followed by
bundle install
Please note that you must replace <gemname> above with the name of the actual gem that is throwing the error while building native extensions.
I hope this becomes helpful to others that face similar issues in the future!
I used a simple solution... install through brew
brew install name

Error installing ruby-2.0.0-p353 using RVM

I am trying to install and set up my dev environment for RoR, on a Mac OSX Maverick 10.9.
After run the command:
$ rvm install ruby-2.0.0-p353
the following error out:
Installing required packages: libyaml, openssl.
Error running 'requirements_osx_brew_libs_install libyaml openssl',
showing last 15 lines of /Users/wlinares/.rvm/log/1388963243_ruby-2.0.0-p353/package_install_libyaml_openssl.log
esac;
return $ret
}
}
I downloaded libyaml from http://pyyaml.org/download/libyaml/ and installed following the default instructions.
Then I made the same for openssl so it was installed successfully under: /usr/lib/
Anyone has overcome this error? thanks!
You could try:
$ rvm install 2.0.0-p353 --autolibs=enable
After trying many tricks I could not overcome the issue, then I uninstalled everything and restart the process as a beginner I am. I decided to run the command.
$ gem install rails
then I installed gems:
$ gem install rubygems-update
and finally tested the environment with: rails new blog command.
Until here all seems to be working fine, but I am following the ruby guides in order to start coding my project. I don't have RVM now so I don't know how to handle with upgrades and versions.
That is my only problem, because I was told that Rails change frequently.
I would like to know now how to handle with upgrades including gems.

Can't install Ruby 1.9.3 on Mac OSX 10.7.5

Yes, I know there's some questions posted regarding issues of installing Ruby 1.9.3 on Lion, mainly because of problems with later versions of Xcode (4.3.2 in my case).
However, I've tried all there is to try that's posted here on Stack regarding this manner, and nothing helps. It starts to compile, one minute or two passes and then suddenly halts.
As examples I've tried with the following (of course I have GCC installer installed):
rvm install 1.9.3
rvm install 1.9.3 --with-gcc=clang
rvm install 1.9.3 --with-gcc=gcc-4.2
If running rvm install 1.9.3 the following error shows during the compilation (which halts the installation):
Error running 'make', please read /Users/henrikpetersson81/.rvm/log/ruby-1.9.3-p374/make.log
There has been an error while running make. Halting the installation.
Here you can read the log file from the latest build fail:
http://jsfiddle.net/hyhrk/
Last thing I've tried was to follow the updated guide in this answer. Same problem.
What can be the problem here?
NOTE. I've the following installed:
Ruby 1.8.7
Homebrew 0.7.1
RVM 1.17.10
GCC installer 4.2.1
Xcode 4.3.2
Command Line Tools
RVM has an updated command to install all required libraries:
rvm get head
rvm requirements run
It might ask you for your password (for sudo).
After that run:
rvm install 1.9.3 --with-opt-dir=`brew --prefix readline` --without-tcl --without-tk
Update RVM 1.19+
RVM takes care of it all:
rvm get stable
rvm autolibs homebrew
rvm install 1.9.3
It looks like there are issues with readline. Since you're using Homebrew, you can try this:
brew install readline
rvm install 1.9.3 --with-readline=`brew --prefix readline`

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