SQLite remains one of my go-to choices for local development and lightweight applications. And getting it set up on macOS takes just a few minutes when you use Homebrew.
SQLite installation tutorials
- Multi-Platform SQLite Installation Guide
- Install SQLite3 on Debian Using APT
- Install SQLite3 on Ubuntu Using APT
- Install SQLite3 on macOS (Built-in Installation Guide)
- Install SQLite3 on Fedora/CentOS
- Install SQLite3 on Android (using Termux)
- Install SQLite3 in iOS Apps (Objective C and Swift)
- Install SQLite3 in a Python Virtual Environment
What You Need Before Starting
MacOS comes with SQLite pre-installed, but it’s often an older version. Homebrew lets you grab the latest release and manage updates cleanly. You’ll need Homebrew installed on your Mac first. If you don’t have it yet, head to brew.sh and follow their installation instructions.
Check Your Current SQLite Version
Open Terminal and run:
sqlite3 --version
You’ll see something like 3.39.5 or another version number. The system version works fine for basic tasks, but newer releases include performance improvements and bug fixes that matter for production work.
Install SQLite Through Homebrew
Run this command in Terminal:
brew install sqlite
Homebrew will download the package and install it. The process takes about 30 seconds to a couple of minutes, depending on your internet speed.
Update Your PATH Configuration
Here’s where it gets specific. Homebrew installs SQLite in a different location than the system version. You need to tell your shell to use the Homebrew version instead.
Open your shell configuration file. If you use zsh (the default on modern macOS):
nano ~/.zshrc
For bash users:
nano ~/.bash_profile
Add this line at the end of the file:
export PATH="/opt/homebrew/bin:$PATH"
Note: If you’re on an Intel Mac, use /usr/local/bin instead of /opt/homebrew/bin.
Save the file (Control + O, then Enter, then Control + X in nano).
Load Your New Configuration
Make your terminal recognize the changes:
source ~/.zshrc
Or for bash:
source ~/.bash_profile
Verify the Installation
Check which SQLite version your terminal sees:
which sqlite3
You should see /opt/homebrew/bin/sqlite3 (or /usr/local/bin/sqlite3 on Intel Macs).
Run the version check again:
sqlite3 --version
You’ll see the newer version number that Homebrew just installed.
Start Using SQLite
Create a test database to confirm everything works:
sqlite3 test.db
You’ll enter the SQLite prompt. Try creating a simple table:
CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT);
INSERT INTO users (name) VALUES ('Alice');
SELECT * FROM users;
Type .exit
to leave the SQLite prompt.
Keep SQLite Updated
Homebrew makes updates straightforward. Run these commands periodically:
brew update
brew upgrade sqlite
The first command refreshes Homebrew’s package list. The second upgrades SQLite to the latest available version.
Common Issues and Solutions
Terminal still shows the old version: Your PATH configuration might not have loaded properly. Close your terminal completely and open a new window. If that doesn’t work, double-check that you edited the correct shell configuration file.
Permission errors: Homebrew occasionally needs you to fix permissions. Run brew doctor
to see specific recommendations for your system.
Multiple SQLite installations causing conflicts: Use brew list sqlite
to see what Homebrew installed. You can uninstall with brew uninstall sqlite
and start fresh if needed.
Why Choose Homebrew for SQLite
Homebrew gives you version control that the system installation doesn’t provide. When you need a specific SQLite feature or want to match your production environment’s version, Homebrew lets you install exactly what you need. The package manager also handles dependencies automatically and keeps everything organized in one place.
I manage dozens of development tools through Homebrew, and SQLite is one of the simplest installations you’ll do. The whole process from start to finish takes under five minutes once you know the steps.