Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7618493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:25:05+00:00 2026-05-31T03:25:05+00:00

I am able to install the json library using ruby gems. In case it’s

  • 0

I am able to install the json library using ruby gems. In case it’s relevant, I’m using the latest OS X.

usr$ sudo gem install json
Password:
Building native extensions.  This could take a while...
Successfully installed json-1.6.5
1 gem installed
Installing ri documentation for json-1.6.5...
Installing RDoc documentation for json-1.6.5...

However, attempting to require 'json' it doesn’t work. What am I doing wrong?

touakas-MacBook-Pro:tmp jacob$ ruby x.rb
x.rb:3:in `require': no such file to load -- json (LoadError)
    from x.rb:2

The x.rb is as follows:

#!/usr/bin/env ruby
require 'json'

x = { "a"=>"b" }
print x.to_json
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T03:25:06+00:00Added an answer on May 31, 2026 at 3:25 am

    You need to load RubyGems first:

    require 'rubygems'
    require 'json'
    

    Edit:

    According to the comment below, you’d better use ruby -rubygems x.rb rather than require rubygems directly (suppose that you’re writing a module for resue).

    Credit to: @injekt and @Ingenu

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to install bcrypt-ruby on Windows Vista. So far, I have been able
I'm able to install own application into /system/app using adb shell commands. But how
I am able to install an apk file stored on sdcard using the following
I'm trying to install DBD::mysql using most of the popular methods, including sudo cpanm
I am not able to install VS2010 and WM7's SDK side by side. Has
I am looking to create a web-project that is able to install with a
The whole point of rvm is to be able to install multiple rubies and
i published an application in vb.net. the user will be able to install the
In the past, on Windows XP machines, I was able to install P4V (the
I m able to build a windows service and install it. I m curious

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.