Vitaly S.
Vitaly S.

Reputation: 2389

Sqlite3 is available in irb, but not in ruby on Mac OS X Lion

I'm trying to start ruby script that uses sqlite3, but I get an error:

$ ruby data.rb 
data.rb:1:in `require': no such file to load -- sqlite3 (LoadError)
    from data.rb:1

Sqlite3 for ruby is installed

$ gem list

*** LOCAL GEMS ***

sqlite3 (1.3.5)

If I try to use sqlite3 from irb it works:

$ irb
>> require 'sqlite3'
=> true

How can I fix the issue?

Upvotes: 2

Views: 464

Answers (1)

Xaca Xulu
Xaca Xulu

Reputation: 659

At the top of your data.rb file try this:

require "rubygems"
require "sqlite3"

Save and try:

ruby data.rb

Upvotes: 4

Related Questions