SQLite - Installation
SQLite - Modern Installation Guide
Section titled “SQLite - Modern Installation Guide”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.
Install SQLite on Windows
Section titled “Install SQLite on Windows”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.
Method 1: Using winget (Recommended)
Section titled “Method 1: Using winget (Recommended)”Open PowerShell or Command Prompt and run:
winget install SQLite.SQLiteMethod 2: Using Scoop
Section titled “Method 2: Using Scoop”If you use Scoop, you can install SQLite with:
scoop install sqliteMethod 3: Manual Installation
Section titled “Method 3: Manual Installation”- 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*.zipfile. - Step 3: Create a folder, for example
C:\sqlite, and extract the contents of the zip file into it. You will getsqlite3.exe,sqldiff.exe, andsqlite3_analyzer.exe. - Step 4: Add the folder (
C:\sqlite) to your system’s PATH environment variable to accesssqlite3from any command prompt.
Install SQLite on Linux
Section titled “Install SQLite on Linux”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.
Using a Package Manager (Recommended)
Section titled “Using a Package Manager (Recommended)”- For Debian/Ubuntu:
sudo apt-get update && sudo apt-get install sqlite3 - For Fedora/CentOS/RHEL:
sudo dnf install sqliteorsudo yum install sqlite - For Arch Linux:
sudo pacman -S sqlite
Advanced: Compiling from Source
Section titled “Advanced: Compiling from Source”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 installInstall SQLite on macOS
Section titled “Install SQLite on macOS”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.
Using Homebrew (Recommended)
Section titled “Using Homebrew (Recommended)”If you don’t have Homebrew, install it from https://brew.sh. Then, run the following command in your terminal:
$ brew install sqliteHomebrew 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.
Verifying the Installation
Section titled “Verifying the Installation”After installation, open a new terminal or command prompt and check the version:
$ sqlite3 --version3.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.
$ sqlite3SQLite version 3.45.1 2024-03-13 11:04:34Enter ".help" for usage hints.Connected to a transient in-memory database.Use ".open FILENAME" to reopen on a persistent database.sqlite> .quit