10

I'm trying to install gems to my new Ruby project using bundle install. I've set the version of Ruby using rbenv on my OS X 10.8.4 box. I get the following error:

An error occurred while installing atomic (1.1.13), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.13'` succeeds before bundling.
Kikime:jazzcatalog curt$ gem install atomic
Building native extensions.  This could take a while...
Successfully installed atomic-1.1.13
1 gem installed
Kikime:jazzcatalog curt$ rbenv rehash
Kikime:jazzcatalog curt$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.1.0) 
Using i18n (0.6.5) 
Using minitest (4.7.5) 
Using multi_json (1.7.9) 
Installing atomic (1.1.13) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/Users/curt/.rbenv/versions/2.0.0-p247/bin/ruby extconf.rb 
/Users/curt/.rbenv/versions/2.0.0-p247/bin/ruby: invalid option -R  (-h will show valid       options) (RuntimeError)


Gem files will remain installed in /Volumes/Data     RAID/htdocs/jazzcatalog/vendor/bundle/gems/atomic-1.1.13 for inspection.
Results logged to /Volumes/Data RAID/htdocs/jazzcatalog/vendor/bundle/gems/atomic- 1.1.13/ext/gem_make.out

An error occurred while installing atomic (1.1.13), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.13'` succeeds before bundling.

The first two lines are the end of the output from first attempt. As you can see, I then successfully installed atomic as requested. I then tried again and got the same error. I've seen a few errors with installing atomic, but none like this one. It seems to have a problem with the option -R. Since I didn't enter it in the first place, I don't know where to change it.

Update

I started all over rbenv set to version 2.0.0-p0 and and ran rails new jazz catalog -d mysql. It died at the same place with this error:

Installing atomic (1.1.13)

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/Users/curt/.rbenv/versions/2.0.0-p0/bin/ruby extconf.rb 
creating Makefile

make
compiling atomic_reference.c
 atomic_reference.c:50:9: warning: implicit declaration of function  'OSAtomicCompareAndSwap64' is invalid in C99 [-Wimplicit-function-declaration]
if (OSAtomicCompareAndSwap64(expect_value, new_value, &DATA_PTR(self))) {
    ^
1 warning generated.
linking shared-object atomic_reference.bundle

make install
/usr/bin/install -c -m 0755 atomic_reference.bundle /Volumes/Data   RAID/htdocs/jazzcatalog/vendor/bundle/gems/atomic-1.1.13/lib
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
           [-o owner] file1 file2
   install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
           [-o owner] file1 ... fileN directory
   install -d [-v] [-g group] [-m mode] [-o owner] directory ...
make: *** [install-so] Error 64


Gem files will remain installed in /Volumes/Data     RAID/htdocs/jazzcatalog/vendor/bundle/gems/atomic-1.1.13 for inspection.
Results logged to /Volumes/Data RAID/htdocs/jazzcatalog/vendor/bundle/gems/atomic- 1.1.13/ext/gem_make.out
An error occurred while installing atomic (1.1.13), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.13'` succeeds before bundling.

SOLVED Sigh - does not handle spaces in path

curt
  • 4,422
  • 3
  • 42
  • 61

8 Answers8

19

I had this problem. It turned out to be caused by installing Mac OS 10.9 (Mavericks), since Mavericks has a new stand alone command line tools separate from Xcode. To solve this, I deleted /Applications/Xcode and then installed the stand alone command line tools via:

Note: First line may not be needed, see comments below

sudo rm -rf /Applications/Xcode
xcode-select --install

then click 'install' from the OSX pop up window

source: http://www.computersnyou.com/2025/2013/06/install-command-line-tools-in-osx-10-9-mavericks-how-to/

Andy Waite
  • 10,785
  • 4
  • 33
  • 47
webdevguy
  • 975
  • 10
  • 17
  • 2
    You might have to agree to the new license agreement. I rand `sudo gcc -v` to make sure I had version 4.2 it then prompted me to agree to the license agreement. 'gem update' worked after that. – Blake Erickson Nov 08 '13 at 14:06
  • @BlakeErickson I don't think I had to sign any agreement when I went through these steps. Perhaps I'd signed it before. – webdevguy Nov 09 '13 at 15:37
  • Ditto on having to run sudo gcc -v to accept the license agreement. Been stuck for a couple of hours and you guys saved me. Thanks. – Agazoom Nov 23 '13 at 16:04
  • 3
    I actually didn't had to remove Xcode to make it work. The second command was enough. I don't get the point of removing Xcode... Installing the command line tools is enough. – PofMagicfingers Nov 24 '13 at 04:55
  • 3
    Just running the second line worked for me also. Oddly, `--install` isn't even listed as an option when you run `xcode-select --help`. – Andy Waite Dec 02 '13 at 23:03
8

For those who reach this page by googling, I solved a similar issue while Installing atomic (1.1.13) on mac this way:

    sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2

It seems to be because of conflicting Xcode updates.

Reza Hashemi
  • 1,768
  • 14
  • 13
  • 1
    Thanks for including your solution. It's not an easy problem to debug. – curt Aug 20 '13 at 22:14
  • 1
    I had to recreate this link after upgrading to Mavericks. My old simplink was to /usr/bin/llvm-gcc-4.2 and i had to change it so it points to /usr/bin/llvm-gcc (note the lack of the 4.2 postfix). – Travis Castillo Mar 18 '14 at 16:59
4

The error messages don't give the slightest clue as to what the real problem is. Bundler or a component it calls does not properly handle directory names with spaces in them. In my case it was .../Data RAID/... that caused the problem. Once I moved the project to a different drive where there would be no spaces in the path, everything worked fine. It appears it may be only the location of the gems that are the issue. In an earlier attempt, I created a project where the gems weren't located in a path containing spaces, but the project was. It didn't have any problems as far as I went with it. Notice also that the gem install atomic was successful.

curt
  • 4,422
  • 3
  • 42
  • 61
  • That sounds like this issue: http://bugs.ruby-lang.org/issues/show/3024 though that says it's fixed in 2.0.0. – Tim Moore Aug 23 '13 at 04:13
  • It's probably similar. My problem is with Rails, which is a separate application. I don't know closely linked the two development groups are or if code is shared between the apps. – curt Aug 23 '13 at 16:28
  • There should be an StackWTF version for this kind of issues. Thousands of thanks to you @curt – sonxurxo Mar 25 '14 at 12:14
0

If you're attempting to install Atomic (or bundle update - and that is failing on atomic), on Mac/OSX - you will need to install or update your command line tools for XCode for whatever OS version you are using.

As mentioned above, but I feel like that answer is a little esoteric. Atomic needs these tools for multithreading.

etusm
  • 4,082
  • 1
  • 30
  • 26
0

I was getting the same error message and it seems to have been caused by a (seemingly harmless yet erroneous) line in my Gemfile. When used correctly (on a system using RVM) these two lines should be able to use the correct version of Ruby and the desired gemset.

ruby '2.0.0'
#ruby-gemset=railstut_rails_4_0 ; ruby-2.0.0-p247@railstut_rails_4_0

I was under the impression that I was merely adding a comment with the second line- however RVM (by design/as expected) created a new gemset with a name "*railstut_rails_4_0 ; ruby-2.0.0-p247@railstut_rails_4_0*" that had spaces and special characters. Every time I ran bundle install - even after I changed the name inside the Gemfile - RVM loaded the current erroneous gemset. To resolve, I did the following:

  1. $ rvm use ruby-2.0.0-p247@railstut_rails_4_0
  2. Update Gemfile: The first two of the following lines for the benefit of RVM setup; followed by a comment for personal reference:

    ruby '2.0.0'
    #ruby-gemset=railstut_rails_4_0
    #ruby-2.0.0-p247@railstut_rails_4_0

  3. bundle install --without production

  4. bundle update
  5. bundle install
sojourner
  • 117
  • 4
  • 12
0

For those who got here by googling: I ran into something similar with atomic 1.1.14.

In my case it was actually Avast (anti-virus program) that wouldn't let me execute an atomic-specific file.

It was solved by excluding the file from Avast, and then run gem install atomic -v '1.1.14' again.

0

I'm using Mac OS Lion, and for resolve this problem i installed the new Command Line Tools. Steps: Open XCode -> Downloads -> Install Command Line Tools. Just it.

0

This 100% has to do with Spaces in the path. The error it spits out shows the attempted install path. Annoying error.

Taylor Halliday
  • 640
  • 1
  • 8
  • 19