Katerina Katerina - 4 months ago 16x
Ruby Question

"require" command not found when require 'nokogiri'

Homebrew, ruby 2.0.0p648, nokogiri are installed. When require 'nokogiri' there appears an error:

-bash: require: command not found

What's wrong?


You can't run a Ruby command directly in bash. If you want to use Ruby at command line, open the Ruby shell irb.

$ irb

and then you'll see the prompt

2.3.0 :001 >

The first number indicates the Ruby version you are using. In my case it is Ruby 2.3.0. The second number is the command number.

Then you may type

require 'nokogiri'

and it surely work, if you have this gem installed.