Installing ruby-usb (0.2.1) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /Users/felix/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb checking for usb_init() in -lusb... no checking for ruby/st.h... yes creating Makefile make Makefile:165: warning: overriding commands for target `/Users/felix/.rvm/gems/ruby-1.9.2-p290@blinky/gems/ruby-usb-0.2.1/lib' Makefile:163: warning: ignoring old commands for target `/Users/felix/.rvm/gems/ruby-1.9.2-p290@blinky/gems/ruby-usb-0.2.1/lib' clang -I. -I/Users/felix/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/x86_64-darwin11.4.0 -I/Users/felix/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/felix/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -I. -DHAVE_RUBY_ST_H -I/Users/felix/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -o usb.o -c usb.c clang: warning: argument unused during compilation: '-ggdb' usb.c:27:10: fatal error: 'usb.h' file not found #include <usb.h> ^ 1 error generated. make: *** [usb.o] Error 1 Gem files will remain installed in /Users/felix/.rvm/gems/ruby-1.9.2-p290@blinky/gems/ruby-usb-0.2.1 for inspection. Results logged to /Users/felix/.rvm/gems/ruby-1.9.2-p290@blinky/gems/ruby-usb-0.2.1/./gem_make.out An error occured while installing ruby-usb (0.2.1), and Bundler cannot continue. Make sure that `gem install ruby-usb -v '0.2.1'` succeeds before bundling.
Why? -- Because I didn't follow the instructions!
Well, after coming back and reading through all the instructions on Blinky Wiki page, I thought it would be very easy, but it turned out not.
I have mac ports installed, so I just did the following:
sudo port install libusb
Libusb was successfully installed, and I was still failing on finding the 'usb.h'. I'd also tried to port install a few other things, but no luck. There must be something wrong. While I was searching online for solutions, I started installing Homebrew, which I had always been hesitating to move onto.
Homebrew installation completed before I got any useful suggestions from the Internet, so I just followed the instruction to run the following command:
brew install libusb-compat
Then I run bundle install again -- all green!! Phew~~~
Hope this post saves you at least 2 minutes of searching too. :)