0

I m trying to install Rails on my Macbook but ive had no luck Ive tried everything

-Homebrew -RVM -Jewelry box I read here that by installing xcode and then trying to install rails again it might work.... it might worked for someone else but me........ this is the error Im getting.....

Thanks in advance.

    $ sudo gem install rails
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for libkern/OSAtomic.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --with-atomic_reference-dir
    --without-atomic_reference-dir
    --with-atomic_reference-include
    --without-atomic_reference-include=${atomic_reference-dir}/include
    --with-atomic_reference-lib
    --without-atomic_reference-lib=${atomic_reference-dir}/
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:430:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:545:in `block in try_compile'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:498:in `with_werror'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:545:in `try_compile'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1040:in `block in have_header'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:891:in `block in checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:336:in `block (2 levels) in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:306:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:336:in `block in postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:306:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:332:in `postpone'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:890:in `checking_for'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1039:in `have_header'
    from extconf.rb:17:in `<main>'


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/atomic-1.1.16 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/atomic-1.1.16/ext/gem_make.out
$ rails --version
Rails is not currently installed on this system. To get the latest version, simply type:

    $ sudo gem install rails

You can then rerun your "rails" command.
$ 

** UPDATE **

I installed the xcode command line developer tools successfully and then went ahead to try and install rails and it gave me a new error that goes like this.......

$ sudo gem install rails
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for libkern/OSAtomic.h... yes
creating Makefile

make "DESTDIR="
compiling atomic_reference.c
atomic_reference.c:57:59: warning: incompatible pointer types passing 'void **' to parameter of type 'volatile int64_t *' (aka 'volatile long long *') [-Wincompatible-pointer-types]
    if (OSAtomicCompareAndSwap64(expect_value, new_value, &DATA_PTR(self))) {
                                                          ^~~~~~~~~~~~~~~
/usr/include/libkern/OSAtomic.h:507:93: note: passing argument to parameter '__theValue' here
bool    OSAtomicCompareAndSwap64( int64_t __oldValue, int64_t __newValue, volatile int64_t *__theValue );
                                                                                            ^
1 warning generated.
linking shared-object atomic_reference.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: *** [atomic_reference.bundle] Error 1


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/atomic-1.1.16 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/atomic-1.1.16/ext/gem_make.out
Juanto85
  • 33
  • 2
  • 10
  • Looks like your new issue is a duplicate of this one: http://stackoverflow.com/questions/22461011/new-rails-project-bundle-install-cant-install-rails-in-gemfile/22491165#22491165 – David Underwood Mar 21 '14 at 20:31
  • possible duplicate of [Ruby Gem install Json fails on Mavericks and Xcode 5.1 - unknown argument: '-multiply\_definedsuppress'](http://stackoverflow.com/questions/22352838/ruby-gem-install-json-fails-on-mavericks-and-xcode-5-1-unknown-argument-mul) – Nakilon Apr 20 '14 at 01:22

3 Answers3

1

Read your output carefully:

You have to install development tools first.

Looks like you need to install the OSX development tools. The simplest way to do this in Mavericks is by running xcode-select to trigger the install as described in this guide: http://www.computersnyou.com/2025/2013/06/install-command-line-tools-in-osx-10-9-mavericks-how-to/

Nakilon
  • 34,866
  • 14
  • 107
  • 142
David Underwood
  • 4,908
  • 1
  • 19
  • 25
  • I tried that too. but I get an error that says "Cant install software because it is not currently available from the software update server" – Juanto85 Mar 21 '14 at 19:25
  • Try a different source then. You can get it directly from Apple's developer website (If you sign in with an Apple ID): https://developer.apple.com/xcode/downloads/ – David Underwood Mar 21 '14 at 19:28
  • not my lucky day.... I download it from the apples developer site and it installed like a charm but when I did sudo gem install rails it gave me another error – Juanto85 Mar 21 '14 at 19:36
  • if you installed ruby using rvm (simple) , then don't use sudo – Alok Yadav Apr 21 '14 at 21:21
0

It seems like you have not installed XCode in the system.

First install XCode from the Mac Store(or just command line tools as suggested by @DavidUnderwood) Once installed, go to Preferences -> Downloads -> Install Command Line Tools

Also found an excellent resource on Rails Guide as Rails One Click for Mac.

Refer to step by step guide from Rackspace.

Kirti Thorat
  • 52,578
  • 9
  • 101
  • 108
0

I had the same problem... Did lots of google and finally found the solution

try writing this in the terminal :

sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install rails

The solutions was suggested here - Trouble installing rails on MAC OS X 10.9.2

Community
  • 1
  • 1