Error While loading sqlite3 in ruby

hi kengey ,

How to check this out,

Thanks Dan., will look into it.

the same error inside sketchup also
"require ‘sqlite3’
Error: #<LoadError: cannot load such file – sqlite3>
C:/Program Files/SketchUp/SketchUp 2017/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:54:in require' C:/Program Files/SketchUp/SketchUp 2017/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:54:inrequire’

:in `' SketchUp:1:in `eval'"


Please see Installing ruby gems in Sketchup

That message refers to installing another gem. Ignore step #1, as the dll issue doesn’t affect sqlite3.

As to the gem, it is located at:


It needs to be downloaded.

So, once you have the gem and downloaded & extracted, in the SketchUp Ruby console::

require '<path>/su_gem.rb'

SUGem.install '-lN <path>/sqlite3-1.4.0.mspgreg-x64-mingw32.gem'

You should be able to use SQLite3 with SU2019 or SU2017/18.

The gem is compiled statically with SQLite3, so no ‘DevKit’ or additional installation is needed.

Thanks Greg, will check and revert.

this file file located where?

Sorry, it’s attached to this message:

Thank you!

it shows false when called ‘require sqlite3’

What was the response to the following:

SUGem.install '-lN <path>/sqlite3-1.4.0.mspgreg-x64-mingw32.gem'


Maybe a better description of what you should be doing & why. The goal is to install a local gem file.

  1. RubyGems is designed to be a console application. In SketchUp (SU), the ruby console is more like an IRB session, where you can directly type ruby commands into it.

  2. There are few files contained in, but one of them (su_gem.rb), allows one to use the RubyGems parameter style used in a normal console with RubyGems in the SU Ruby console.

  3. The following command loads this file, which creates a module (SUGem). You should replace “<path>” with the path to wherever you unzipped the file.

require '<path>/su_gem.rb'
  1. Before continuing, you need to download the gem file (sqlite3-1.4.0.mspgreg-x64-mingw32.gem) from the page listed above. Nothing involving SU, just a browser…

  2. Once you have that on your system, the line

SUGem.install '-lN <path>/sqlite3-1.4.0.mspgreg-x64-mingw32.gem'

install the gem. Again, you should replace “<path>” with the path to wherever the file is located. FYI, the 'l' option tells RubyGems that it’s a local operation, it shouldn’t connect to to look for the gem. The 'N' option tells it to not generate rdoc files for the gem.

I’m about 99.9% sure the gem works. It passed all the sqlite3 tests using Ruby versions 2.2 thru 2.6.


One other thing. In your first message you showed

ruby 2.5.5p157 (2019-03-15 revision 67260) [x64-mingw32]

That is a stand-alone version of Ruby that you installed. There is essentially no connection between it and the version of Ruby installed by SketchUp. The current installation of SketchUp does not allow for any way to share gems between it and a stand-alone Ruby version.

FYI, they (Trimble) could change that by allowing SU Ruby to install or use gems in the standard RubyGems --user-install folder.

I tried this with SU 2018.

When I entered:

SUGem.install '-lN <path>/sqlite3-1.4.0.mspgreg-x64-mingw32.gem'

The response was:

Successfully installed sqlite3-1.4.0.mspgreg-x64-mingw32
1 gem installed

Also, the output from SUGem.list should show the gem name.

Lastly, using the example from, every thing ran fine (created a database, added records, read records).

If it’s working in SU 2018, I’m sure it will do the same in SU 2019. Please read the instructions again…

Hi Greg.,
I was out for few days, not able to reply. Apologize.

  1. My Goal to learn how to create a database with fields in different table , access the created database->Table-> Field, write the values or store the parameters of the dynamic components, query and retrieve the values from database based on the requirement from sketchup using ruby Console.

I got the output as u had mentioned in the console.
“Successfully installed sqlite3-1.4.0.mspgreg-x64-mingw32
1 gem installed”
Hope will work… Will try and let u know… Meanwhile i am using SU 2017

yes it shows the gem name in the console.

Hi @MSP_Greg, the appveyor link is not available anymore. How can we reach the “sqlite3-1.4.0.mspgreg-x64-mingw32.gem” file?

Thank you.


Yes, the AppVeyor artifacts are deleted after some months.

It might have to wait for the weekend. I can’t recall how I built it, but the system I wrote to do so broke when Ruby decided to skip over 2.8 and 2.9. I haven’t looked at it for while.

I’ve always thought Trimble/SU should consider some way of hosting a few ‘pre-compiled’ gems commonly used in SU. Things like SQLite3 & Nokogiri come to mind. Not sure about any others, maybe some image processing gems?

No support provided, as long as they work. Most of the common gems are relatively stable, so versions could probably stay the same for a while.

If one absolutely has to have the latest/greatest version, they can build their own.

Ok @MSP_Greg, that would be great!

It happens the same with rbclipper, but we achieved compiling it and requiring the .so file.

The problem is that we use some SketchUp plugins that need sqlite3 and it’s code is encrypted.


please check out this link!. is this the one your are looking for!

It didn’t work for me, the Ruby Console still says that “cannot load such file”.


I found the original file, and it’s at:

I may do a build with 1.4.2, which is the current gem version.

Thank you @MSP_Greg, it worked!