Skip to content

SQLite - Installation

SQLite is renowned for its zero-configuration, serverless, and self-contained design. This makes it an ideal database for development, testing, and embedded applications in mobile devices, web browsers, and desktop software. This chapter guides you through installing SQLite using modern tools on Windows, Linux, and macOS.

The recommended way to install SQLite on Windows is by using a package manager like Windows Package Manager (winget) or Scoop. This automates the download and PATH configuration.

Open PowerShell or Command Prompt and run:

winget install SQLite.SQLite

If you use Scoop, you can install SQLite with:

scoop install sqlite
  • Step 1: Go to the official SQLite download page (https://www.sqlite.org/download.html).
  • Step 2: In the “Precompiled Tools for Windows” section, download the sqlite-tools-win*.zip file.
  • Step 3: Create a folder, for example C:\sqlite, and extract the contents of the zip file into it. You will get sqlite3.exe, sqldiff.exe, and sqlite3_analyzer.exe.
  • Step 4: Add the folder (C:\sqlite) to your system’s PATH environment variable to access sqlite3 from any command prompt.

Most Linux distributions come with SQLite pre-installed. You can verify this by opening a terminal and typing sqlite3. If it’s not installed or you need a newer version, use your distribution’s package manager.

  • For Debian/Ubuntu: sudo apt-get update && sudo apt-get install sqlite3
  • For Fedora/CentOS/RHEL: sudo dnf install sqlite or sudo yum install sqlite
  • For Arch Linux: sudo pacman -S sqlite

For the absolute latest version, you can compile from source. This is for advanced users.

# Download the latest autoconf-*.tar.gz from sqlite.org/download.html
$ tar xvfz sqlite-autoconf-*.tar.gz
$ cd sqlite-autoconf-*
$ ./configure --prefix=/usr/local
$ make
$ sudo make install

macOS includes a system version of SQLite, but it is often outdated. The recommended way to install and manage a modern version of SQLite is with Homebrew.

If you don’t have Homebrew, install it from https://brew.sh. Then, run the following command in your terminal:

$ brew install sqlite

Homebrew will handle the installation and PATH configuration for you. You may need to restart your terminal or source your shell profile file (e.g., source ~/.zshrc) for the changes to take effect.

After installation, open a new terminal or command prompt and check the version:

$ sqlite3 --version
3.45.1 2024-03-13 11:04:34 a4999f345386c9360875727a4e69a237142416f40c73336214d02641a87b417c (example output)

You can now start the SQLite command-line shell by typing sqlite3. This will open an in-memory database.

$ sqlite3
SQLite version 3.45.1 2024-03-13 11:04:34
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .quit