command line tools for new 10.9 OSX for ruby gems?

2019-01-10 09:33发布

After installing OSX Mavericks 10.9 demo, Im getting this after running bundle

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

    /Users/sandric/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
extconf.rb:17: Use RbConfig instead of obsolete and deprecated Config.
checking for socket() in -lsocket... *** 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=/Users/sandric/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
    --with-iconv-dir
    --without-iconv-dir
    --with-iconv-include
    --without-iconv-include=${iconv-dir}/include
    --with-iconv-lib
    --without-iconv-lib=${iconv-dir}/lib
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --with-socketlib
    --without-socketlib
/Users/sandric/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/sandric/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
    from /Users/sandric/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
    from /Users/sandric/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
    from /Users/sandric/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:845:in `block in have_library'
    from /Users/sandric/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /Users/sandric/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /Users/sandric/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/sandric/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /Users/sandric/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/sandric/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /Users/sandric/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /Users/sandric/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:840:in `have_library'
    from extconf.rb:27:in `<main>'


Gem files will remain installed in /Users/sandric/.bundler/tmp/5282/gems/libxml-ruby-2.6.0 for inspection.
Results logged to /Users/sandric/.bundler/tmp/5282/gems/libxml-ruby-2.6.0/ext/libxml/gem_make.out
An error occurred while installing libxml-ruby (2.6.0), and Bundler cannot continue.
Make sure that `gem install libxml-ruby -v '2.6.0'` succeeds before bundling.

I think that I do not have command line tools, so I tried to download some. It found out that there is no usual link for this in my XCode (it is 4, not 5, dont know why. If there is some way of installing fifth xcode - please help). So I went to apple developers webpage and not found command line tools for 10.9. I tried for 10.8 - it prints "Try install for 10.7", after trying with tools for 10.7 - it prints "try for 10.8".

Please, help. I'll provide all info for help.

8条回答
成全新的幸福
2楼-- · 2019-01-10 10:21

I just upgraded mountain lion to mavericks and received the above message.

I ended up launching XCode and it asked to install components automatically. After that was completed I re-bundled and it worked.

查看更多
Animai°情兽
3楼-- · 2019-01-10 10:32

If you're using Ruby version manager (rvm) the following worked for me.

Before you run the following, be sure to verify the symbolic link in /Users/yourusername/.rvm/rubies/. Mine looks like this...

default -> /Users/yourusername/.rvm/rubies/ruby-1.9.3-p429

If your sym link isn't set correctly, you can set it using...

cd /Users/yourusername/.rvm/rubies/
ln -s /Users/yourusername/.rvm/rubies/ruby-1.9.3-p429 default

Then run the following from the command line

rvm system
rvm gemset export system.gems
rvm 1.9.3 #use your Ruby version here
rvm gemset import system.gems

now you should be ready to install your gems

gem install yourgemname
查看更多
登录 后发表回答