Mavericks 10.9 trouble installing gem - ruby

I've been struggling to install jekyll on my mac, don't know much about ruby or configuring/debugging these messages.
I'm getting the following when running "sudo gem install jekyll"
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
creating Makefile
make "DESTDIR="
make: *** No rule to make target `/include/universal-darwin13/ruby/config.h', needed by `porter.o'. Stop.
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/fast-stemmer-1.0.2 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/fast-stemmer-1.0.2/ext/gem_make.out
"gcc --version" returns the following:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

use this command :
$ sudo xcode-select -r
then
$ sudo gem install jekyll
Hope this help you.

Besides upgrading xcode, as rayrashmi suggested, you have to actually open it so the command-line tools are properly installed.
(I am assuming you installed the command-line tools from xcode before upgrading to mavericks, if you haven't they're under Preferences → Downloads → Components, official info here.)
Then, just upgrade gem if you haven't already done so and install jekyll and any other library you were using, like pigments.
As they say, "worked for me."

Related

Cannot install pushmeup plugin

I try to install pushmeup plugin for phonegap push notifications (ios).
When I run command sudo gem install pushmeup I get this error:
Building native extensions. This could take a while... ERROR: Error
installing pushmeup: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
extconf.rb creating Makefile
make "DESTDIR=" clean
make "DESTDIR=" compiling generator.c linking shared-object
json/ext/generator.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: * [generator.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in
/Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for inspection. Results
logged to
/Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/json-1.8.1/gem_make.out
GitHub:
https://github.com/phonegap-build/PushPlugin
Params:
ruby -v ruby 2.0.0p247 (2013-06-27 revision 41674)
[universal.x86_64-darwin13]
gem -v
2.2.2
Mac OS X v 10.9.2
XCode Version 5.1 (5B130a)
cordova -v
3.4.0-0.1.3
Apparently Apple broke something on Mavericks, they removed the warning flag unused-command-line-argument-hard-error-in-future acording to this issue: #528
Please try this command:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future sudo gem install pushmeup
what it does? this sets the environment variable: ARCHFLAGS= this adds a ignore warnings -Wno-error= and this is the warning that you don't see in mavericks unused-command-line-argument-hard-error-in-future (which should be ignored)
In Apple documentation:
Compiler
As of Apple LLVM compiler version 5.1 (clang-502) and later, the
optimization level -O4 no longer implies link time optimization (LTO).
In order to build with LTO explicitly use the -flto option in addition
to the optimization level flag. (15633276) The Apple LLVM compiler in
Xcode 5.1 treats unrecognized command-line options as errors. This
issue has been seen when building both Python native extensions and
Ruby Gems, where some invalid compiler options are currently
specified. Projects using invalid compiler options will need to be
changed to remove those options. To help ease that transition, the
compiler will temporarily accept an option to downgrade the error to a
warning:
-Wno-error=unused-command-line-argument-hard-error-in-future
Note: This option will not be supported in the future. To workaround
this issue, set the ARCHFLAGS environment variable to downgrade the
error to a warning. For example, you can install a Python native
extension with:
$ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
easy_install ExtensionName
Similarly, you can install a Ruby Gem with:
$ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
gem install GemName 16214764 updated
EDIT HISTORY
just tested on my machine, using same ruby:
$ gem install pushmeup
Fetching: pushmeup-0.1.2.gem (100%)
Successfully installed pushmeup-0.1.2
Parsing documentation for pushmeup-0.1.2
Installing ri documentation for pushmeup-0.1.2
Done installing documentation for pushmeup after 1 seconds
1 gem installed
From what i saw you are not using rvm or rbenv so the problem is not in gcc dependencies
Accordingly to the output provided, the error was when installing json-1.8.1.
Can you post the log located at: /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/json-1.8.1/gem_make.out ?

Ruby Gem install Json fails on Mavericks and Xcode 5.1 - unknown argument: '-multiply_definedsuppress'

I was trying run gem install json and got the following error
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
linking shared-object json/ext/generator.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: *** [generator.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /opt/boxen/repo/.bundle/ruby/2.0.0/gems/json-1.8.0 for inspection.
Results logged to /opt/boxen/repo/.bundle/ruby/2.0.0/extensions/universal-darwin-13/2.0.0/json-1.8.0/gem_make.out
I'm using:
Os X: 10.9.2
Xcode: 5.1 Build version 5B130a
Command Line Tools (CLT): 5.1.0.0.1.1393561416
Ruby: ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
Ruby Gem: 2.2.2
GCC: 4.2.1 Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
I am encountering the exact same problem after updating Xcode to 5.1 and news from Apple aren't good. From Xcode 5.1 Release Notes:
The Apple LLVM compiler in Xcode 5.1 treats unrecognized command-line options as errors. This issue has been seen when building both Python native extensions and Ruby Gems, where some invalid compiler options are currently specified.
Projects using invalid compiler options will need to be changed to remove those options. To help ease that transition, the compiler will temporarily accept an option to downgrade the error to a warning:
-Wno-error=unused-command-line-argument-hard-error-in-future
To workaround this issue, set the ARCHFLAGS environment variable to downgrade the error to a warning.
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install GemName
It seems that all gems violating the compiler options must be updated to use valid options. It is explicitly stated that: This option [downgrading error to warning] will not be supported in the future.
The clang note we are seeing (this will be a hard error (cannot be downgraded to a warning) in the future) corresponds to the change announced in the release notes.
To answer your question specifically, use the following to install the json gem:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install json
Note, however, that this is only a temporary fix.
One-liner to fix that
curl https://gist.githubusercontent.com/Paulche/9713531/raw/1e57fbb440d36ca5607d1739cc6151f373b234b6/gistfile1.txt | sudo patch /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb
To address the issue you can install the most recent version of ruby as described by #Sash. You can use the following commands to do so. In case you already have installed rvm, you don't need to reinstall it.
#Install rvm
\curl -sSL https://get.rvm.io | bash -s stable
#Install ruby version 2.0.0-p451
rvm install ruby-2.0.0-p451
#Print ruby version to verify that it was installed successfully
ruby -v
#Install json gem
sudo gem install json
Issue already addressed by Ruby:
https://bugs.ruby-lang.org/issues/9624
now we just need to wait for Apple to update their ruby version (2.0.0p247) to the one after the latest one (2.0.0p451) which hasn't come out yet ...
(or brew/macport it)
Update (2014-05-15): Mavericks 10.9.3 updates ruby to
ruby 2.0.0p451 (2014-02-24 revision 45167) [universal.x86_64-darwin13]
And this seems to resolves the issue.
#Muncken has already provided an answer to install gem one by one:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install GemName
Base on Muncken's answer, I've tried that it also works when using bundle install
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future bundle install
In my case, I actually have similar problem, but not on the system ruby, but on rubies installed by rvm from OSX 10.8, and it has issues after upgrading to OSX 10.9.
A simple reinstall works: rvm reinstall ruby-2.1.1
On OSX 10.10, I had several issues when running rails new firstapp such as:
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
fatal error: 'ruby/config.h' file not found
I updated rvm with this configuration and all the errors are gone!:
rvm get stable --auto-dotfiles
You can tell from the app name that I just started fiddling with Ruby on Rails, so the above advice may or may not work for you.
Paul Chechetin's one-liner doesn't appear to work anymore (9/21/15). However, this reply to the post mentioned in Pete's reply solved the problem for me:
(a) Install Apple's XCode, then (b) launch it and accept the licensing terms (I had done (a), but not (b).)
sudo gem uninstall compass
sudo gem install compass
None of these worked for me.
What finally worked is running the command with a sudo -
gem install byebug -v '9.0.6'
It's been a while and I've got similar error. An alternative to folks using bundler is to add the flag to the build configuration like below example:
bundle config build.<gemname> --with-cflags="-Wno-error=implicit-function-declaration"
followed by
bundle install
Please note that you must replace <gemname> above with the name of the actual gem that is throwing the error while building native extensions.
I hope this becomes helpful to others that face similar issues in the future!
I used a simple solution... install through brew
brew install name

ERROR: Error installing vagrant: ERROR: Failed to build gem native extension

I'm trying to install vagrant on MacOS (Lion). But it keeps failing.
What happens...
sudo gem update --system
sudo gem install vagrant
Building native extensions. This could take a while... ERROR: Error
installing vagrant: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
extconf.rb mkmf.rb can't find header files for ruby at
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in
/Library/Ruby/Gems/1.8/gems/ffi-1.0.11 for inspection. Results logged
to /Library/Ruby/Gems/1.8/gems/ffi-1.0.11/ext/ffi_c/gem_make.out
I have XCode installed (installed it this morning from the AppStore).
Any ideas how I can fix this?
The problem was that XCode 4.3 doesn't in command line tools by default (not sure if this is the first version that doesn't do this). Installing them got it working.
Command Line Tools can be installed by going to Preferences > Downloads > Components.
I'm not sure why your build was failing, but starting with Vagrant 1.0 (not released yet, but RCs are out), the preferred installation method will be packages, so you can just download a pkg for Mac and install, even without XCode installed: http://downloads.vagrantup.com/

can't install rails 3.1 "native extensions" error

When I try installing rails version 3.1 I get an error in the terminal:
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/alonbond/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
creating Makefile
make
sh: make: command not found
Gem files will remain installed in /Users/alonbond/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/json-1.6.3 for inspection.
Results logged to /Users/alonbond/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/json-1.6.3/ext/json/ext/parser/gem_make.out
and then I try using a rails command:
Alon-Weissfelds-MacBook-Pro:~ alonbond$ rails -v
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.
Try to install Xcode from Mac App Store or GCC compiler https://github.com/kennethreitz/osx-gcc-installer.
Usually Xcode solves all those problems. The GCC is not 100% compliant with all gems.

After a new install, the SQLite3 old version persists (OS X)

I've installed the newer version of SQLite3 (3.7.0.1) on my macbook (OS X 10.5) but 'sqlite3 --version' gives me the older version I had on my system:
$ sqlite3 --version
3.4.0
I suppose I was expecting this version to be overwritten but that doesn't seem to be the case. Can anyone clue me in? I'd really appreciate it, right now I'm trying to get started with Rails but I had received this error:
$ sudo gem install sqlite3-ruby
Password:
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for #include <sqlite3.h>
... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... no
checking for sqlite3_initialize()... no
sqlite3-ruby only supports sqlite3 versions 3.6.16+, please upgrade!
*** 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.
Oddly enough though since installing the new version of sqlite3 this error has gone away (in other words sqlite3-ruby was installed successfully) - but sqlite3 still points to 3.4.0, I've checked the directories in my $PATH and they only contain 3.7.0.1
Thanks in advance for any help.
Have you tried telling the OS to use the new one by typing hash sqlite3? Sometimes an OS remembers the original version and doesn't know to refresh itself and hash will poke it in the eye.
Otherwise you might need to tell the gem to look in the right place. Check into these options in the installer:
--with-sqlite3-dir
--with-sqlite3-include
--with-sqlite3-lib
I also face the same problem on my CentOS Server. I found this solution work for me. Hope it help! http://amitava1.blogspot.com/2010/08/ruby-on-rails-on-centos-55-with.html
main process:
$ wget http://www.sqlite.org/sqlite-amalgamation-3.7.0.1.tar.gz
$ tar xvzf sqlite-amalgamation-3.7.0.1.tar.gz
$ cd sqlite-3.7.0.1
$ ./configure --prefix=/opt/local/sqlite-3.7.0.1
$ make
$ sudo make install
$ sudo /opt/ruby-enterprise-1.8.7-2010.02/bin/gem install sqlite3-ruby -- --with-sqlite3-dir=/opt/local/sqlite-3.7.0.1
Building native extensions. This could take a while...
Successfully installed sqlite3-ruby-1.3.1
1 gem installed

Resources