Solution to error failed when installing json on mac OS gem

Source: Internet
Author: User

Upgrade mac OS Mavericks to the latest version. Json loading error:
Copy codeThe Code is as follows:
Gem install json-v '1. 8.1'


Building native extensions. This cocould take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.

/Usr/local/var/rbenv/versions/2.0.0-p247/bin/ruby extconf. rb
Creating Makefile

Make "DESTDIR ="
Compiling generator. c
In file encoded ded from/usr/local/var/rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby. h: 33,
From ../fbuffer. h: 5,
From generator. c: 1:
/Usr/local/var/rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby. h: 51: 21: error: string. h: No such file or directory
/Usr/local/var/rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby. h: 61: 21: error: stdint. h: No such file or directory
/Usr/local/var/rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby. h: 64: 23: error: inttypes. h: No such file or directory
/Usr/local/var/rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby. h: 68: 19: error: stdio. h: No such file or directory
Solution:
Copy codeThe Code is as follows: xcode-select -- install
Command Line Developer Tools needs to be re-installed

If this method still does not work, mac needs to install the apple-gcc42
Copy codeThe Code is as follows: brew install apple-gcc42
Note that brew 0.9.4 should be the source without a apple-gcc42, you can use brew doctor to check whether it is compatible with Mavericks, here you need to upgrade
Copy codeThe Code is as follows: brew update

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.