Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Development Tools Installing a Ruby Development Environment Installing a Ruby Development Environment Installing Ruby on Mac

Miha Vičič
Miha Vičič
10,262 Points

Problems with installing rails

Hello! I'm struggling with the last step of setting up rails. When I try to install the rail gem I get the following error: Building native extensions. This could take a while... ERROR: Error installing rails: ERROR: Failed to build gem native extension.

/Users/vicic/.rbenv/versions/2.2.0/bin/ruby -r ./siteconf20150119-78332-aigbdm.rb extconf.rb

checking if the C compiler accepts ... yes checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no

Building nokogiri using packaged libraries.

The file "/usr/include/iconv.h" is missing in your build environment, which means you haven't installed Xcode Command Line Tools properly.

To install Command Line Tools, try running xcode-select --install on terminal and follow the instructions. If it fails, open Xcode.app, select from the menu "Xcode" - "Open Developer Tool" - "More Developer Tools" to open the developer site, download the installer for your OS

version and run it.

*** 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/vicic/.rbenv/versions/2.2.0/bin/$(RUBY_BASE_NAME) --help --clean --use-system-libraries --enable-static --disable-static --with-zlib-dir --without-zlib-dir --with-zlib-include --without-zlib-include=${zlib-dir}/include --with-zlib-lib --without-zlib-lib=${zlib-dir}/lib --enable-cross-build --disable-cross-build

extconf failed, exit code 1

Gem files will remain installed in /Users/vicic/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.5 for inspection. Results logged to /Users/vicic/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.5/gem_make.out

1 Answer

Hi Miha, have you tried installing the Xcode command line tools as suggested in the error message and then retrying the install?

 xcode-select --install

it helps! thank you so much!!!

No problem!