gem install json issue with Mac OS X 10.11 - ruby

I'm trying to install Ruby/JSON on Mac OS X 10.11.
However, the gem install command gives the error message:
smcho#macho ruby-rails-sample> gem install json
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/Users/smcho/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20151025-39148-au2m2x.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
linking shared-object json/ext/generator.bundle
ld: warning: directory not found for option '-L/Users/haven/.sm/pkg/active/lib'
make "DESTDIR=" install
./install -m 0755 generator.bundle ./.gem.20151025-39148-i7g03f/json/ext
make: ./install: No such file or directory
make: *** [install-so] Error 1
make install failed, exit code 2
Gem files will remain installed in /Users/smcho/.rvm/gems/ruby-2.2.1/gems/json-1.8.3 for inspection.
Results logged to /Users/smcho/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0-static/json-1.8.3/gem_make.out
The message says make: ./install: No such file or directory, but I'm not sure how to fix this issue.
Is this a known issue, or is there a way to bypass this one?
This is my system version. I executed gem update --system to get the latest version.
> ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
> gem -v
2.4.8

I should have used the latest ruby (2.2.3) not the old one (2.2.1)
ruby-rails-sample> rvm --default use 2.2.3
Using /Users/smcho/.rvm/gems/ruby-2.2.3
smcho#macho ruby-rails-sample> gem install json
Building native extensions. This could take a while...
Successfully installed json-1.8.3
Parsing documentation for json-1.8.3
Installing ri documentation for json-1.8.3
Done installing documentation for json after 1 seconds
1 gem installed

Related

gem install not finding ruby.h file

I am trying to use bundle install to install fastlane. I am having an issue installing one of the dependencies, json 2.6.1. I get the following error.
Fetching json 2.6.1
Installing json 2.6.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
C:/tools/ruby30/lib/ruby/gems/3.0.0/gems/json-2.6.1/ext/json/ext/generator
C:/tools/ruby30/bin/ruby.exe -I C:/tools/ruby30/lib/ruby/3.0.0 -r
./siteconf20211128-18184-scdpps.rb extconf.rb
creating Makefile
current directory:
C:/tools/ruby30/lib/ruby/gems/3.0.0/gems/json-2.6.1/ext/json/ext/generator
make DESTDIR\= clean
current directory:
C:/tools/ruby30/lib/ruby/gems/3.0.0/gems/json-2.6.1/ext/json/ext/generator
make DESTDIR\=
generating generator-x64-mingw32.def
compiling generator.c
In file included from generator.c:1:
../fbuffer/fbuffer.h:5:10: fatal error: ruby.h: No such file or directory
5 | #include "ruby.h"
| ^~~~~~~~
compilation terminated.
make: *** [Makefile:245: generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in
C:/tools/ruby30/lib/ruby/gems/3.0.0/gems/json-2.6.1 for inspection.
Results logged to
C:/tools/ruby30/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/json-2.6.1/gem_make.out
An error occurred while installing json (2.6.1), and Bundler cannot continue.
Make sure that `gem install json -v '2.6.1' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
fastlane was resolved to 2.198.1, which depends on
json
I have the following specs on my system.
windows 10
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x64-mingw32]
Gemfile
source "https://rubygems.org"
gem "fastlane"
Thanks for the help!

Cannot install gem file

I've been on this for a few hrs already googled everything. Tried tons of answers, im using ruby x64 and devkit x64 (originaly isntalled the incorect one x32 but i just deleted it and installed the correct one x64)
Cant install json or (my actual target) ruby-debug-ide -v 0.4.32
gem version = 2.4.7
ruby version =ruby 2.4.2p198 (2017-09-14 revision 59899) [x64-mingw32]
C:\WINDOWS\system32>gem install json
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
C:/Ruby24-x64/bin/ruby.exe -r ./siteconf20171013-12212-1y42085.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating generator-x64-mingw32.def
compiling generator.c
linking shared-object json/ext/generator.so
c:/ruby24-x64/programing/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgmp
collect2.exe: error: ld returned 1 exit status
make: *** [generator.so] Error 1
make failed, exit code 2
Gem files will remain installed in C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/json-2.1.0 for inspection.
Results logged to C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/json-2.1.0/gem_make.out
You might want to try a cloud9 editor, and per this tutorial https://www.railstutorial.org/book/beginning
It will save you quite a bit of pain setting up your rails environment.

Can't install Jekyll on MacOS Sierra 10.12.1

I'm trying to install Jekyll using:
sudo gem install jekyll
but I get a error, I had found a solution on early mac version not for Sierra
this is the output:
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.17/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20170117-1518-aaehhb.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.17 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-16/2.0.0/ffi-1.9.17/gem_make.out
thanks for advance!
You have to install the Ruby DevKit. Depending on your installation of Ruby, you have to select the correct way to install it.

Error installing RedCloth (4.2.9) on OS X 10.9.2

I try to install Jekyll with pages, using enter link description here.
The process stops when installing RedCloth (4.2.9): "Make sure that gem install RedCloth -v '4.2.9' succeeds before bundling."
The results below (I changed https in H due to url limitations in this Question).
I run OS X 10.9.2
Step 1 = OK
mikea:mego mikea$ ruby --version
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
Step 2 = OK
mikea:mego mikea$ sudo gem install bundler
Password:
Successfully installed bundler-1.5.3
Parsing documentation for bundler-1.5.3
1 gem installed
Step 3 = NOK
mikea:mego mikea$ bundle install
Fetching gem metadata from H://rubygems.org/.......
Fetching additional metadata from h://rubygems.org/..
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --with-cflags=-w
checking for main() in -lc... yes
creating Makefile
make "DESTDIR="
compiling redcloth_attributes.c
compiling redcloth_inline.c
compiling redcloth_scan.c
linking shared-object redcloth_scan.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: *** [redcloth_scan.bundle] Error 1
Gem files will remain installed in /Users/mikea/.bundler/tmp/25125/gems/RedCloth-4.2.9 for inspection.
Results logged to /Users/mikea/.bundler/tmp/25125/gems/RedCloth-4.2.9/ext/redcloth_scan/gem_make.out
An error occurred while installing RedCloth (4.2.9), and Bundler cannot
continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.
I solved this by install rbenv with brew, and then install ruby 2.1.1 through rbenv. Finally change the ruby version to 2.1.1. Here is the command:
$brew update
$brew install rbenv
$rbenv install 2.1.1
$rbenv global 2.1.1
log out. Now you can try your 3 step.
I did not use hue answer to install rbenv with brew. Maybe you can use it.
I solved the problem by using Terminal, first go to the folder in Sites and then type:
jekyll serve --watch --baseurl ""

Error: Installing vagrant gem in ruby 2.0.0

When I tried to install vagrant gem in ruby 2.0.0-p0, I am getting follwoing error:
~ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
~ gem -v
2.0.0.rc.2
~ gem list json
*** LOCAL GEMS ***
json (1.7.7)
~ gem install vagrant
Building native extensions. This could take a while...
ERROR: Error installing vagrant:
ERROR: Failed to build gem native extension.
/home/user_name/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
checking for ruby/re.h... yes
checking for ruby/encoding.h... yes
creating Makefile
make
compiling generator.c
generator.c: In function ‘cState_aref’:
generator.c:736:5: warning: variable ‘state’ set but not used [-Wunused-but-set-variable]
linking shared-object json/ext/generator.so
make install
/usr/bin/install -c -m 0755 generator.so /home/user_name/.rvm/gems/ruby-2.0.0-p0/gems/json-1.5.5/ext/json/ext/json/ext
/usr/bin/install: cannot create regular file `/home/user_name/.rvm/gems/ruby-2.0.0-p0/gems/json-1.5.5/ext/json/ext/json/ext': No such file or directory
make: *** [install-so] Error 1
Gem files will remain installed in /home/user_name/.rvm/gems/ruby-2.0.0-p0/gems/json-1.5.5 for inspection.
Results logged to /home/user_name/.rvm/gems/ruby-2.0.0-p0/gems/json-1.5.5/ext/json/ext/generator/gem_make.out
I figure, its using json-1.5.5 from /home/user_name/.rvm/gems/ruby-2.0.0-p0/gems/ while building the gem and getting the above error.
I tried re-installing the latest json-1.7.7 gem and still it fails to install.
Update your rubygems with: gem update --system
Here is the commit that fixed this issue: https://github.com/rubygems/rubygems/commit/1ca11d00833bbca33215ff581303d1fee8f2d1ef

Resources