Sqlite installation


I think I installed sqlite properly but when I put the command gem install sqlite3 i get this

C:\sqlite\sqlite3>gem install sqlite3
Temporarily enhancing PATH for MSYS/MINGW…
Installing required msys2 packages: mingw-w64-x86_64-sqlite3
error: failed to init transaction (unable to lock database)
error: could not lock database: File exists
if you’re sure a package manager is not already
running, you can remove /var/lib/pacman/db.lck
pacman failed with the following output:
Building native extensions. This could take a while…
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.

current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.0/ext/sqlite3

C:/Ruby25-x64/bin/ruby.exe -r ./siteconf20190204-7288-4n43be.rb extconf.rb
checking for sqlite3.h… no
sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:

To see why this extension failed to compile, please check the mkmf.log which can be found here:


extconf failed, exit code 1

Gem files will remain installed in C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.0 for inspection.
Results logged to C:/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/sqlite3-1.4.0/gem_make.out


The first line:

C:\sqlite\sqlite3>gem install sqlite3

already let’s us know that you downloaded the sqlite3’s precompiled binaries for Windows from the download page:



If that is true, then you have to run this command:

gem install sqlite3 --platform=ruby – --with-sqlite3-include=[path\to\sqlite3.h] --with-sqlite3-lib=[path\to\sqlite3.o]

from where you the downloaded the sqlite source:

((wild guess)) $ gem install sqlite3 --platform=ruby – --with-sqlite3-include=c:/sqlite/sqlite3 --with-sqlite3-lib=c:/sqlite/sqlite3/.libs/

from inside the MINGW32 terminal, not the cmd prompt window nor powershell

Here is the detailed list from where I grabbed the solution:

Let me know if you need any more help.


Running that command did not work