44

Here is what I have done so far.

  1. Clean install of OS X Lion
  2. Downloaded and installed latest version of Xcode from the App Store.
  3. Installed Git
  4. Installed Homebrew
  5. Installed RVM

I am now trying to install Ruby Enterprise Edition for a project with rvm install ree and receive the following error:

$ rvm install ree
ree-1.8.7-2011.03 - #installing
ERROR: Error running './installer -a /Users/FaraazKhan/.rvm/rubies/ree-1.8.7-2011.03
  --no-tcmalloc --dont-install-useful-gems ', please read
  /Users/FaraazKhan/.rvm/log/ree-1.8.7-2011.03/install.log
ERROR: There has been an error while trying to run the ree installer. Halting
  the installation.

I have already tried CC=/usr/bin/gcc-4.2 rvm install ree and with the same result.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Faraaz Khan
  • 701
  • 2
  • 8
  • 13
  • 2
    What does /Users/FaraazKhan/.rvm/log/ree-1.8.7-2011.03/install.log say? – Chris Ledet Jul 24 '11 at 00:45
  • Here is the output of cat /Users/FaraazKhan/.rvm/log/ree-1.8.7-2011.03/install.log [2011-07-23 20:16:52] ./installer -a /Users/FaraazKhan/.rvm/rubies/ree-1.8.7-2011.03 --no-tcmalloc --dont-install-useful-gems Welcome to the Ruby Enterprise Edition installer This installer will help you install Ruby Enterprise Edition 1.8.7-2011.03. Don't worry, none of your system files will be touched if you don't want them to, so there is no risk that things will screw up. – Faraaz Khan Jul 24 '11 at 01:08
  • You can expect this from the installation process: 1. Ruby Enterprise Edition will be compiled and optimized for speed for this system. 2. Ruby on Rails will be installed for Ruby Enterprise Edition. 3. You will learn how to tell Phusion Passenger to use Ruby Enterprise Edition instead of regular Ruby. Press Enter to continue, or Ctrl-C to abort. Checking for required software... – Faraaz Khan Jul 24 '11 at 01:10
  • * C compiler... found at /usr/bin/gcc-4.2 * C++ compiler... found at /usr/bin/g++ * The 'make' tool... found at /usr/bin/make * The 'patch' tool... found at /usr/bin/patch * Zlib development headers... found * OpenSSL development headers... found * GNU Readline development headers... found – Faraaz Khan Jul 24 '11 at 01:10
  • -------------------------------------------- Target directory Auto-installing to: /Users/FaraazKhan/.rvm/rubies/ree-1.8.7-2011.03 -------------------------------------------- Compiling and optimizing Ruby Enterprise Edition In the mean time, feel free to grab a cup of coffee. – Faraaz Khan Jul 24 '11 at 01:11
  • It looks like the source is already configured. Skipping configure script... /usr/bin/gcc-4.2 -dynamiclib system_allocator.c -install_name @rpath/libsystem_allocator.dylib -o libsystem_allocator.dylib mkdir -p .ext/common make PREINCFLAGS='-I/opt/local/include' PRELIBS='-L/opt/local/lib -Wl,-rpath,/Users/FaraazKhan/.rvm/rubies/ree-1.8.7-2011.03/lib -L/Users/FaraazKhan/.rvm/rubies/ree-1.8.7-2011.03/lib -lsystem_allocator' ./ext/purelib.rb:2: [BUG] Segmentation fault ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin11.0.0], MBARI 0x6770, Ruby Enterprise Edition 2011.03 – Faraaz Khan Jul 24 '11 at 01:11
  • make: *** [.rbconfig.time] Abort trap: 6 @Chris – Faraaz Khan Jul 24 '11 at 01:12

8 Answers8

85

I was able to duplicate your error, just now. This solved it for me:

$ rvm remove ree
$ export CC=/usr/bin/gcc-4.2
$ rvm install --force ree

JofoCodin
  • 1,965
  • 16
  • 11
  • Thank you! I have installed rvm system-wide and used `sudo CC=/usr/bin/gcc-4.2 rvm install --force ree` – Lorenz Aug 16 '11 at 11:32
  • Hey Lorenz, I'm glad it worked. But fyi, you shouldn't need to use sudo to install rubies with a system-wide install. Make sure your user account is added to the rvm group (in /etc/group) and you should be golden to manage rubies with your non-privileged account. – JofoCodin Aug 16 '11 at 21:13
  • This fix worked for me as well. Installing ree with rvm on OSX Lion. 1.9.2-p290 and 1.9.3-preview1 both worked with my rvm install of all three. What I saw was that the ree install was using /usr/bin/gcc vs the export using /usr/bin/gcc-4.2. In case anyone needs to diagnose further. Thanks for your solution JofoCodin. – craigmartin Aug 28 '11 at 20:38
  • Also, if you're having a readline issue, this worked for me: `rvm install ree --force -C --with-readline-dir=$HOME/.rvm/usr` – Andrew K Sep 20 '11 at 16:40
  • Did not work for me. Colleague downloaded and installed Lion and XCode last week. Today he tried to follow these instructions, but /usr/bin/gcc-4.2 does not exist. Where do we get it? Does this solution still work for other people? – Alan Hensel Oct 24 '11 at 19:44
  • Just wanted to leave an update here that this solution won't work any longer for XCode 4.2.x. Starting with 4.2.1, XCode defaults to using the LLVM compiler and gcc-4.2 is not installed. See Alex Dixon's answer here for a solution: http://stackoverflow.com/questions/7734344/bug-bus-error-ruby-1-8-7 – JofoCodin Dec 19 '11 at 03:47
  • You can get gcc-4.2 from: https://github.com/kennethreitz/osx-gcc-installer/downloads. Once I got that installed, the above steps worked perfectly. – jmccartie Jun 12 '12 at 16:31
4

Using MacPorts you can install Ruby Enterprise Edition, as well as Ruby 1.9.2 for the local user in OS X Lion while having Xcode 4.2 installed by using "Apple's version of gcc 4.2."

Prerequisites:

  • OS X Lion (tested in 10.7.2)
  • Xcode 4.2
  • rvm 1.9.1
  • MacPorts 2.0.3

Execute the following commands:

$ sudo port install apple-gcc42

$ export CC=/opt/local/bin/gcc-apple-42

then

$ rvm install ree

$ rvm use ree

or

$ rvm install 1.9.2

$ rvm use 1.9.2

optionally

$ rvm use ree --default

or

$ rvm use 1.9.2 --default

I hope this helps.

-Joe

Community
  • 1
  • 1
jbg
  • 111
  • 1
  • 9
  • Using this solution does **not** require you to downgrade to Xcode 4.1 as others have stated. – jbg Oct 30 '11 at 18:12
  • sudo port install apple-gcc42 is very useful. Thank you. – Jirapong Dec 03 '11 at 08:10
  • Please note "port install apple-gcc42" creates a folder "gcc-apple-4.2", so the next line should be "export CC=/opt/local/bin/gcc-apple-4.2", it's easy to miss and get an error – f055 Feb 12 '14 at 14:29
4

No need to install MacPorts or downgrade to 4.1 to get GCC, I used the installer package at https://github.com/kennethreitz/osx-gcc-installer with xCode 4.2 already installed, and had no problem installing 1.9.2-head and 1.9.2-p290.

2

Please do NOT use sudo with RVM, nor do you need to use rvmsudo EXCEPT for when upgrading RVM itself. Please see and read https://rvm.io/support/faq/ (Do I need to use sudo with gems? entry) and https://rvm.io/support/troubleshooting/ (Multi-User Installs - Using the sudo command entry)

Please remove your current installation and start over as using sudo will definitely mess up the permission structure for RVM. Please see the very bottom of https://rvm.io/support/troubleshooting/ (How do I completely clean out all traces of RVM from my system, including for system wide installs? entry)

Then begin again strictly following the Multi-User installation segment of https://rvm.io/rvm/install/

Thank you.

mpapis
  • 52,729
  • 14
  • 121
  • 158
ddd
  • 1,925
  • 12
  • 19
2

I did something similar to what jbg advised. Only I didn't use MacPorts. I just used the latest GCC package for Lion here.

This was after spending about a day and a half trying all of the other suggestions, downgrading to Xcode 4.1, etc. to no avail.

By the way, the direct link to Xcode 4.1 at Apple's site gave me an invalid checksum error, all three times I downloaded it. I saw a Twitter post from someone else who had the same problem.

user210977
  • 139
  • 1
  • 3
  • This worked like a charm. After installing GCC package execute `rvm install 1.9.3 --with-gcc=gcc-4.2` and you are set. Thanks user210977! – scetoaux Jan 17 '12 at 23:27
  • 1
    You might appreciate this bash script I wrote to "automate" the process. It also ties in with a custom Soloist (Chef) recipe list. https://gist.github.com/1454081 – user210977 Apr 18 '12 at 22:35
2

At the risk of redundancy, I'll post my answer as well, since I tried everything on this page (and many others) and ended up with a hybrid of some of them which seemed the most likely to work. Note that some of these steps may not have been explicitly necessary but they were sufficient (i.e., I didn't go back and remove potentially unnecessary steps to get the simplest path to success).

Environment: Mac OS Lion 10.7.3, Homebrew components, rvm 1.10.2, ree 1.8.7-2012.01, Xcode 4.2.1 with legacy gcc-4.2 available.

Steps:

  1. Ensure that a stable Ruby is current. Used 1.9.2 (rvm use 1.9.2) as 1.9.3 was a potential problem.
  2. rm -fr $rvm_path/usr
  3. rvm pkg install ree_dependencies
  4. rvm remove ree
  5. export CC=/usr/bin/gcc-4.2
  6. rvm install ree \ --with-openssl-dir=$rvm_path/usr \ --with-readline-dir=$rvm_path/usr \ --with-iconv-dir=$rvm_path/usr \ --with-zlib-dir=$rvm_path/usr

I had previously tried the brew-specific solutions but those didn't work for me. Hope this helps someone!

rholmes
  • 4,064
  • 3
  • 25
  • 34
1

If you are on Lion 10.7.2, and have installed XCode 4.2, you need to downgrade XCode to 4.1

Here's how I did it (it was more complicated than you might think):

  • Download XCode 4.1 from Apple Dev Center (you'll need to login with your dev centre creds)
  • uninstall XCode 4.2

    $ sudo /Developer/Library/uninstall-devtools --mode=all

  • remove the XCode installer from your /Applications directory

  • run the XCode 4.1 package you downloaded, this will install a new XCode installer into /Applications
  • run the XCode installer in /Applications
  • When it stops, asking you to quit iTunes, you need to quit iTunes, and also use Activity Monitor to force quit the iTunes Helper
  • Wait for XCode 4.1 to install
  • Use the steps outlined above to install ree

Cheers, Ian

i2w
  • 118
  • 2
  • 6
1

This is how i did to install it. May be previous answers are already solve your problem. My step may be help people who experience same as me.

Frist, Install MacPort latest version

>rvm uninstall ree
>sudo port install apple-gcc42
>export CC=/opt/local/bin/gcc-apple-4.2
>rvm pkg install zlib openssl readline
>rvm install --force ree

Result is:

IronB:~ ...$ rvm install --force ree
Installing Ruby Enterprise Edition from source to: /Users/.../.rvm/rubies/ree-1.8.7-2011.03
ree-1.8.7-2011.03 - #fetching (ruby-enterprise-1.8.7-2011.03)
ree-1.8.7-2011.03 - #extracting ruby-enterprise-1.8.7-2011.03 to /Users/.../.rvm/src/ree-1.8.7-2011.03
Applying patch 'tcmalloc' (located at /Users/.../.rvm/patches/ree/1.8.7/tcmalloc.patch)
Applying patch 'stdout-rouge-fix' (located at /Users/.../.rvm/patches/ree/1.8.7/stdout-rouge-fix.patch)
Applying patch 'no_sslv2' (located at /Users/.../.rvm/patches/ree/1.8.7/no_sslv2.diff)
ree-1.8.7-2011.03 - #installing 
Removing old Rubygems files...
Installing rubygems-1.8.10 for ree-1.8.7-2011.03 ...
Installation of rubygems completed successfully.
ree-1.8.7-2011.03 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ree-1.8.7-2011.03 - #importing default gemsets (/Users/.../.rvm/gemsets/)

I'm also put this to my ~/.rvmrc for next time

 # Make this work with OS X Lion... for now...
 if [[ `uname -v` =~ "Darwin Kernel Version 11" ]] ; then
       export CC=/opt/local/bin/gcc-apple-4.2
 fi
Jirapong
  • 24,074
  • 10
  • 54
  • 72