Can't install Ruby under Lion with RVM – GCC issues
Asked Answered
R

15

268

Most questions regarding this problem are due to missing Xcode; I have Xcode 4.2 installed.

Install attempt:

rvm install 1.9.3
Installing Ruby from source to: /Users/jamie/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)...

ruby-1.9.3-p0 - #fetching 
ruby-1.9.3-p0 - #extracted to /Users/jamie/.rvm/src/ruby-1.9.3-p0 (already extracted)
Fetching yaml-0.1.4.tar.gz to /Users/jamie/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/jamie/.rvm/src
Configuring yaml in /Users/jamie/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/jamie/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/jamie/.rvm/usr
ruby-1.9.3-p0 - #configuring 
ERROR: Error running ' ./configure --prefix=/Users/jamie/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml-dir=/Users/jamie/.rvm/usr ', please read /Users/jamie/.rvm/log/ruby-1.9.3-p0/configure.log
ERROR: There has been an error while running configure. Halting the installation.

configure.log:

[2011-11-07 04:32:17]  ./configure --prefix=/Users/jamie/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml-dir=/Users/jamie/.rvm/usr 
configure: WARNING: unrecognized options: --with-libyaml-dir
checking build system type... x86_64-apple-darwin11.2.0
checking host system type... x86_64-apple-darwin11.2.0
checking target system type... x86_64-apple-darwin11.2.0
checking whether the C compiler works... no
configure: error: in `/Users/jamie/.rvm/src/ruby-1.9.3-p0':
configure: error: C compiler cannot create executables
See `config.log' for more details

GCC is available:

gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.1~1/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.1~1/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

ls /usr/bin | grep gcc         
gcc
i686-apple-darwin11-llvm-gcc-4.2
llvm-gcc
llvm-gcc-4.2

Based on config.log (posted at bottom due to size) I tried symlinking gcc-4.2 to gcc and then installing:

rvm install 1.9.3                       
ERROR: The autodetected CC(/usr/bin/gcc-4.2) is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`, and set CC=/path/to/gcc .

So I could probably just grab gcc elsewhere, but I'm mostly concerned as to why this is happening. Shouldn't installing Xcode be enough?

config.log:

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.68.  Invocation command line was

  $ ./configure --prefix=/Users/jamie/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml-dir=/Users/jamie/.rvm/usr

## --------- ##
## Platform. ##
## --------- ##

hostname = Wilson.local
uname -m = x86_64
uname -r = 11.2.0
uname -s = Darwin
uname -v = Darwin Kernel Version 11.2.0: Tue Aug  9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64

/usr/bin/uname -p = i386
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = Mach kernel version:
     Darwin Kernel Version 11.2.0: Tue Aug  9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64
Kernel configured for up to 4 processors.
4 processors are physically available.
4 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1 2 3
Primary memory available: 8.00 gigabytes
Default processor set: 110 tasks, 546 threads, 4 processors
Load average: 1.28, Mach factor: 2.71
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /Users/jamie/.rvm/usr/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /usr/local/bin
PATH: /usr/X11/bin
PATH: /Users/jamie/bin
PATH: /Users/jamie/.rvm/bin
PATH: /Users/jamie/.rvm/bin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2764: checking build system type
configure:2778: result: x86_64-apple-darwin11.2.0
configure:2849: checking host system type
configure:2862: result: x86_64-apple-darwin11.2.0
configure:2882: checking target system type
configure:2895: result: x86_64-apple-darwin11.2.0
configure:3376: checking for C compiler version
configure:3385: gcc-4.2 --version >&5
./configure: line 3387: gcc-4.2: command not found
configure:3396: $? = 127
configure:3385: gcc-4.2 -v >&5
./configure: line 3387: gcc-4.2: command not found
configure:3396: $? = 127
configure:3385: gcc-4.2 -V >&5
./configure: line 3387: gcc-4.2: command not found
configure:3396: $? = 127
configure:3385: gcc-4.2 -qversion >&5
./configure: line 3387: gcc-4.2: command not found
configure:3396: $? = 127
configure:3416: checking whether the C compiler works
configure:3438: gcc-4.2    conftest.c  >&5
./configure: line 3440: gcc-4.2: command not found
configure:3442: $? = 127
configure:3480: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define CANONICALIZATION_FOR_MATHN 1
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3485: error: in `/Users/jamie/.rvm/src/ruby-1.9.3-p0':
configure:3487: error: C compiler cannot create executables
See `config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=x86_64-apple-darwin11.2.0
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=x86_64-apple-darwin11.2.0
ac_cv_prog_CC=gcc-4.2
ac_cv_target=x86_64-apple-darwin11.2.0

## ----------------- ##
## Output variables. ##
## ----------------- ##

ALLOCA=''
AR=''
ARCHFILE=''
ARCH_FLAG=''
AS=''
ASFLAGS=''
BASERUBY='ruby'
BUILTIN_ENCOBJS=''
BUILTIN_TRANSOBJS=''
BUILTIN_TRANSSRCS=''
CAPITARGET=''
CC='gcc-4.2'
CCDLFLAGS=''
CFLAGS=''
CHDIR=''
COMMON_HEADERS=''
COMMON_LIBS=''
COMMON_MACROS=''
COUTFLAG=''
CP=''
CPP=''
CPPFLAGS=''
CPPOUTFILE=''
CXX='g++-4.2'
CXXFLAGS=''
DEFS=''
DLDFLAGS=''
DLDLIBS=''
DLEXT2=''
DLEXT=''
DLLWRAP=''
DOT=''
DOXYGEN=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP=''
ENABLE_SHARED=''
EXECUTABLE_EXTS=''
EXEEXT=''
EXPORT_PREFIX=''
EXTOUT=''
EXTSTATIC=''
GCC=''
GNU_LD=''
GREP=''
INSTALLDOC=''
INSTALL_DATA=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
LDFLAGS=''
LDSHARED=''
LDSHAREDXX=''
LIBEXT=''
LIBOBJS=''
LIBPATHENV=''
LIBPATHFLAG=''
LIBRUBY=''
LIBRUBYARG=''
LIBRUBYARG_SHARED=''
LIBRUBYARG_STATIC=''
LIBRUBY_A=''
LIBRUBY_ALIASES=''
LIBRUBY_DLDFLAGS=''
LIBRUBY_LDSHARED=''
LIBRUBY_RELATIVE=''
LIBRUBY_SO=''
LIBS=''
LINK_SO=''
LN_S=''
LTLIBOBJS=''
MAINLIBS=''
MAJOR='1'
MAKEDIRS=''
MAKEFILES=''
MANTYPE=''
MINIOBJS=''
MINIRUBY=''
MINOR='9'
MKDIR_P=''
NM=''
NROFF=''
NULLCMD=''
OBJCOPY=''
OBJDUMP=''
OBJEXT=''
OUTFLAG=''
PACKAGE=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
PKG_CONFIG=''
PREP=''
RANLIB=''
RDOCTARGET=''
RI_BASE_NAME=''
RM=''
RMALL=''
RMDIR=''
RMDIRS=''
RPATHFLAG=''
RUBYW_BASE_NAME='rubyw'
RUBYW_INSTALL_NAME=''
RUBY_BASE_NAME='ruby'
RUBY_INSTALL_NAME=''
RUBY_PROGRAM_VERSION='1.9.3'
RUBY_RELEASE_DATE='2011-10-30'
RUBY_SO_NAME=''
RUNRUBY=''
SET_MAKE=''
SHELL='/bin/sh'
SOLIBS=''
STATIC=''
STRIP=''
SYMBOL_PREFIX=''
TEENY='1'
TEST_RUNNABLE=''
THREAD_MODEL=''
TRY_LINK=''
UNIVERSAL_ARCHNAMES=''
UNIVERSAL_INTS=''
USE_RUBYGEMS=''
WERRORFLAG=''
WINDRES=''
XCFLAGS=''
XLDFLAGS=''
XRUBY=''
XRUBY_LIBDIR=''
XRUBY_RUBYHDRDIR=''
XRUBY_RUBYLIBDIR=''
ac_ct_CC=''
ac_ct_CXX=''
ac_ct_OBJCOPY=''
ac_ct_OBJDUMP=''
arch=''
bindir='${exec_prefix}/bin'
build='x86_64-apple-darwin11.2.0'
build_alias=''
build_cpu='x86_64'
build_os='darwin11.2.0'
build_vendor='apple'
cflags=' ${optflags} ${debugflags} ${warnflags}'
configure_args=''
cppflags=''
cxxflags=' ${optflags} ${debugflags} ${warnflags}'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
debugflags=''
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec=''
exec_prefix='NONE'
host='x86_64-apple-darwin11.2.0'
host_alias=''
host_cpu='x86_64'
host_os='darwin11.2.0'
host_vendor='apple'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
optflags=''
pdfdir='${docdir}'
prefix='/Users/jamie/.rvm/rubies/ruby-1.9.3-p0'
program_transform_name='s&^&&'
psdir='${docdir}'
ridir=''
ruby_pc=''
ruby_version=''
rubyhdrdir=''
rubylibprefix=''
rubyw_install_name=''
sbindir='${exec_prefix}/sbin'
setup=''
sharedstatedir='${prefix}/com'
sitearch=''
sitedir=''
sitehdrdir=''
sysconfdir='${prefix}/etc'
target='x86_64-apple-darwin11.2.0'
target_alias=''
target_cpu='x86_64'
target_os='darwin11.2.0'
target_vendor='apple'
try_header=''
vendordir=''
vendorhdrdir=''
warnflags=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define CANONICALIZATION_FOR_MATHN 1

configure: exit 77
Rolo answered 7/11, 2011 at 4:46 Comment(5)
Have you tried setting CC=/usr/bin/gcc?Reames
Anything interesting in the config.log file?Reames
Hmm; I have the same gcc, and it installed fine :( Second thing on SO that has worked fine for me but not for someone else; usually it's the opposite.Untouchability
mu: I've added the whole config.log now. Nothing unusual to my eyes. This is the version without a symlink. Dave: Well, that's computers :-).Rolo
Thanks to help from @mpapis, I've documented How to Install RVM on Mac OS X 10.8 (Mountain Lion) with Xcode 4.5 without Installing Command Line Tools.Downes
E
553

This answer was edited multiple times and now contains several alternative solutions. Try the simple “Edit 3” solution first.

Ruby 1.9.3-p125 and later have official support for clang, so if you are installing such a version you should not need GCC. If you’re installing an older version of Ruby, read on.

To compile Ruby with GCC, you need a non-LLVM version of GCC, which is no longer included with Xcode 4.2. Install it yourself (or downgrade to Xcode 4.1 temporarily), then do CC=/usr/local/bin/gcc-4.2 rvm install 1.9.3 --enable-shared (substituting the path to your non-LLVM gcc).

Edit: https://github.com/kennethreitz/osx-gcc-installer/downloads may help for installing GCC. There is also some info available by running rvm requirements.

Edit 2: For an easier solution, you can try adding --with-gcc=clang to the arguments to configure for Ruby to use clang instead of GCC.

Edit 3: rvm install 1.9.3 --with-gcc=clang does that for you.

Note: With current versions of Xcode you need to install the command-line tools separately from the Xcode menu -> Preferences -> Downloads -> Components. This is a pre-requisite for doing any compiling with Xcode on the command-line, not just Ruby.

Note 2: If something doesn't work after following the steps, try doing a reboot or re-login to ensure that the environment gets set correctly.

Note 3: Ruby versions prior to 1.9.3-p125 may not always be fully compatible with clang, so test your software thoroughly if using the “edit 3” solution in a production environment.

Ethelstan answered 7/11, 2011 at 4:46 Comment(22)
The GCC-10.7.pkg didn't do it for me – I think it may only work on 10.7.0 (I'm running 10.7.2), but perhaps the v2 pkg works. Anyway, --with-gcc=clang did it for me! Thanks!Rolo
edit3 didn'work for me (Xcode 4.2.1), but after installing readline rvm pkg install readline and passing an extra parameter rvm install 1.9.3 --with-gcc=clang --with-readline-dir=$rvm_path/usr it installed successfully.Alvy
Edit3 : doesn't work, Try to install the gcc separately from github.com/kennethreitz/osx-gcc-installer/downloadsFontenot
Edit 3, boom! Did 1.9.2 instead of 1.9.3 with no problemCocoa
Thank you so much!, we can finally work on these ruby projects with our lion machines again! You are a life saver!Hamitic
Edit 3 Initially didn't work for me, but after restarting my machine it worked. Thanks!Cence
Thanks edit 3 worked straight away (OS X 10.7.2) for ruby 1.9.3Arty
For me on OS X 10.7.2 with Xcode 4.2.1 already installed I needed to download/install the GCC as suggested, then reinstall xcode 4.2.1, then new terminal window and finally edit 3 worked. Thanks.Johathan
just tell configure to search for correct gcc - see my answer belowSerenata
@Serenata That's basically what the solution in edits 2 & 3 is, except that many users will not have the “correct” (non-LLVM) gcc installed and therefore clang is the better choice. (See comments above; edit 3 is the simple one-liner that apparently works for most people.)Ethelstan
The comment by leandro helped me. It may apply to Lion / XCode 4.2 users if Edit 3 still fails with the messages "checking whether the C compiler works... no configure: error: in `/Users/someone/.rvm/src/yaml-0.1.4': configure: error: C compiler cannot create executables" in the configure.logNightly
As noted in this answer, there is another alternative. rvm install 1.9.3 --with-gcc=clang worked for me, but it is not fully supported. You can also use CC=/usr/bin/gcc-4.2 rvm install 1.9.3 --enable-shared, which seems better supported. I used osx-gcc-installer to get 4.2, I believe.Monadelphous
I had to run rvm cleanup sources then --with-gcc=clang workedConditioner
I'm on Lion with XCode 4.3.1 installed and the latest RVM (1.10.2). The only approach which worked for me was sudo CC=/usr/bin/gcc-4.2 rvm install 1.9.3 --enable-shared. Edit 3 just didn't work for me.Druid
@tomtheguvnor Hmm, I just tried this again with the same versions of XCode, RVM, and Lion, and it worked with edit 3. Did you install the command-line tools from XCode 4.3.1 preferences?Ethelstan
@Ethelstan No I hadn't installed the command-line tools. I just installed them and retried installing 1.9.3 using sudo rvm install 1.9.3 --with-gcc=clang and it worked! So thanks. Perhaps update edit 3 to hint that you need command-line tools installed?Druid
And if nothing that was written above works and you already tried "rvm install 1.9.3", try this: "rvm reinstall 1.9.3". It will work!Lagoon
Unfortunately, using the clang compiler actually caused a ton of seg faults. I had to use the older GCC compiler via homebrew, and the seg faults went away. Just wanted to add this in case it helps someone in the future.Turgeon
@JohnK.Chow Do you mean segfaults when compiling or when running Ruby? I haven't experienced either problem, and I've been running the clang-compiled version ever since before posting this answer.Ethelstan
@Ethelstan When running Ruby, specifically when we're running our rspec. I'm running OSX Mountain Lion. Even on our Ubuntu machine (12.04 LTS), it had the exact same seg faults. For our Ubuntu machine, we were running 4.4.1. On our Ubuntu machines, we re-compiled our Ruby with 4.2.3 GCC, and it works like a charm.Turgeon
I have discovered a truly marvelous solution to this, which this character-limit is too short to contain. ;) https://mcmap.net/q/108671/-can-39-t-install-ruby-under-lion-with-rvm-gcc-issuesDownes
Fixed! "With current versions of XCode you need to install the command-line tools separately from the XCode menu -> Preferences -> Downloads -> Components. This is a pre-requisite for doing any compiling with XCode on the command-line, not just Ruby." Just install the command line tools. That's it.Madian
M
22

SUMMARY FOR STACK OVERFLOW

I was trying to install SiriProxy on a clean Lion installation on Xcode from App Store

I kept getting errors like : The provided CC(/usr/bin/gcc) is LLVM based.

bash-3.2$ rvm install 1.9.3
ERROR: The provided CC(/usr/bin/gcc) is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`.


After 2 days finally got it working with these two lines:

https://mcmap.net/q/110801/-ruby-rvm-llvm-and-mysql

bash-3.2$ rvm get head
bash-3.2$ CC=/usr/bin/gcc-4.2 rvm install 1.9.3 --enable-shared

Before that I had tried every stackoverflow article on Ruby and Lion so doing these may have done some setup that helped the above 2 steps work:

Things I tried included:

Running Install Xcode.app (I had downloaded from App Store - running this does futher installation)

Installing

https://github.com/kennethreitz/osx-gcc-installer/downloads may help for installing GCC.

Set up CC in

more /Users//.bash_profile

bash-3.2$ more /Users/<USERNAME>/.bash_profile 
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
export CC=/usr/share/TargetConfigs/bin/gcc

First line came from SiriProxy install instruction https://github.com/plamoni/SiriProxy

2nd line export CC never seemed to work. So dont add.

It had many versions each pointing I finally used CC=/usr/bin/gcc-4.2 rvm install 1.9.3 --enable-shared

Mader answered 4/12, 2011 at 21:17 Comment(3)
Did you try rvm install 1.9.3 --with-gcc=clang?Ethelstan
CC=/usr/bin/gcc-4.2 rvm install 1.9.3 --enable-shared, worked on Snow Leopard with Xcode 4.2, thank you!Ballistic
I'd advise against rvm get head for other users. This pulls from the head of the git repo and may not be stable. rvm get latest grabs the latest stable version. If this doesn't fix this issue for you, the rvm install 1.9.3 --with-gcc=clang is worth a shot first since it's less likely to introduce side effectsSighted
D
18
rvm install 1.9.3 --with-gcc=clang

Worked for me. This was on a brand new Lion with Xcode (had no "traditional" GCC).

Dixon answered 21/2, 2012 at 4:31 Comment(0)
F
8

OK I didn't have to install gcc-4.2 separately, I used the one delivered in Xcode, but I had an issue where the --with-gcc=clang wasn't getting passed through. Added the following line to my .rvmrc:

export rvm_configure_flags="--with-gcc=clang"

Worked as required

rvm upgrade ruby-1.9.2-p290 ruby-1.9.3-p125
...
ruby-1.9.3-p125 - #extracted to /Users/leif/.rvm/src/ruby-1.9.3-p125 (already extracted)
ruby-1.9.3-p125 - #configuring
ruby-1.9.3-p125 - #compiling 
ruby-1.9.3-p125 - #installing
....
Successfully migrated ruby-1.9.2-p290 to ruby-1.9.3-p125
Upgrade complete!

bang:$ ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]

Note my env is the following

OS

Darwin bang.local 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64

Xcode

Xcode 4.2.1 Build 4D502

GCC

i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

lrwxr-xr-x  1 root  wheel  12 22 Dec 21:30 /usr/bin/gcc -> llvm-gcc-4.2

I tried using the answer of passing --with-gcc=clang on the command line to the rvm upgrade command, but it didn't work, it didn't appear to get pass from rvm to configure. Apparently the problem in RVM of arguments not being passed to configure is fixed (in commit 1641ceb0 in 2011), but even after upgrading RVM to latest (via rvm get latest) it still didn't get passed. Using the .rvmrc file was the only way it would work for me.

Frankel answered 18/2, 2012 at 22:18 Comment(0)
M
4

I will suggest brew from rvm requirements I have installed it while I have already installed latest Xcode Version 4.4 (4F250)

Homebrew:

If you are using Homebrew, you can install the apple-gcc42 and required libraries from homebrew/dupes:

  brew update
  brew tap homebrew/dupes
  brew install autoconf automake apple-gcc42
  rvm pkg install openssl

This can live side by side with an existing Xcode 4.2+ install or Command Line Tools for Xcode.

And you can always do

$ brew cleanup [specific-formula or without-formula to clean all]

and then if necessary

$ brew remove apple-gcc42

or any other installed program through brew (see the docs for explanation on those 2 commands), also you can

/join #machomebrew

on freenode (not #homebrew I think that is real homebrew beer and related)

Musquash answered 7/11, 2011 at 4:46 Comment(0)
P
4

Only answering here because I can can't up vote/comment on leandro's comment on the original question. After spending days trying to get this to work, His solution was the one that finally got it working for me:

edit3 didn'work for me (Xcode 4.2.1), but after installing readline

 rvm pkg install readline 

and passing an extra parameter

rvm install 1.9.3 --with-gcc=clang --with-readline-dir=$rvm_path/usr 

it installed successfully.

Prospective answered 1/3, 2012 at 9:23 Comment(0)
A
4

You can try to install Command Line Tools for Xcode, it includes GCC, LLMV and other tools that excluded in Xcode 4.2 and higher.

Amabelle answered 4/4, 2012 at 6:51 Comment(0)
S
1

Just tell configure to use gcc instead of gcc-4.2 on Lion (Mac OSX 10.7.2)

Compiling ruby-1.9.3 from source

You can see in your configure output:

configure:3385: gcc-4.2 --version >&5
./configure: line 3387: gcc-4.2: command not found

If you search the config.log you see:

CC='gcc-4.2'

I had the same problem, so I run configure while selecting gcc instead of gcc-4.2:

> CC=gcc ./configure --prefix=/usr/local 
> make
> make install
> ruby --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]

(I'm not sure what is the configure: WARNING: unrecognized options: --with-libyaml-dir in your output I guess you figured that one out?)

Serenata answered 3/2, 2012 at 15:0 Comment(1)
Note that the OP symlinked gcc to gcc-4.2, which made the command available but revealed the underlying problem that their gcc was actually llvm-gcc (and no non-LLVM GCC was installed).Ethelstan
R
1

Download and use JewelryBox The official RVM GUI for Mac OS. Inside "Add Ruby" select your version of Ruby. Before installing, make sure you select "Use Clang" just as what Edit 3 of the accepted answer in this thread suggests.

Retouch answered 9/3, 2012 at 20:30 Comment(0)
T
1

Got same issue, since I am using Xcode 4.3.2 and Lion 10.7.3, and I changed my laptop few days ago and then transfer all contents from the old laptop. Apparently, some of binaries not get transfer over, such as gcc.

ANd then I did following:

  1. Remove Xcode 4.3.2 by dragging it to trash
  2. Download the gcc install package v2 from https://github.com/kennethreitz/osx-gcc-installer/downloads
  3. Install it
  4. Then rvm install 1.9.2 working for me
Tambac answered 1/4, 2012 at 16:3 Comment(0)
C
1

Make sure you're on the latest rvm. Using rvm 1.10.0 none of the above worked for me. Furthermore, rvm get latest erroneously told me "You already have the latest version!" so I had to rvm implode and reinstall rvm (1.15.4), which automatically gave me ruby 1.9.3-p194 with no fuss.

Carinacarinate answered 18/8, 2012 at 1:42 Comment(0)
M
1

For me, none of the above worked as-is. What finally worked was

rvm get head
rm -rf  /usr/local/lib/libsqlite3*
CC=/usr/bin/gcc-4.2 rvm install 1.9.3 --enable-shared

The special trick was to remove the libsqllite that, according to the build log, was missing the required 64-bit architecture or something.

Morra answered 31/8, 2012 at 13:47 Comment(0)
C
1

A more recent simpler solution is to just use railsinstaller.org. It has osx-gcc packaged within it, so it's as easy as a download and install. After meddling with a new shell recently, i landed up mucking my rails environment. After trying many of the above solutions (which previously worked I might add), I landed up following the below steps to get things working again:

  • nuke your local environment, (think rvm implode and uninstall Xcode)
  • download the pkg from railsinstaller.org
  • double click and install

The installer takes some time considering it installs git, rvm , homebrew and a bunch of other goodies.

Clayclaybank answered 9/12, 2012 at 7:33 Comment(0)
M
1

With brew you can install ruby in a one-liner:

brew install ruby193

Worked out of the box for me on OS X 10.8.4. (If you want 2.0, just run brew install ruby instead)

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.

You might need Xcode and command-line tools, but brew's setup will check all that for you.

Mcmillen answered 18/8, 2013 at 5:2 Comment(0)
F
-1

Try:

rvm install 1.9.3 --force-autoconf

Fontaine answered 4/1, 2012 at 8:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.