FastAPI - Beginner to Pro / Setting Up the Database

Installation of SQLite3 Terminal (Mac)

🗄️ Installation of SQLite3 Terminal

SQLite is a lightweight, serverless database. On macOS, you can use it directly from the Terminal via the sqlite3 command-line tool.


✅ Step 1: Check if SQLite Is Already Installed

macOS often comes with SQLite preinstalled.

Open Terminal and run:

sqlite3 --version

If installed, you’ll see the version number.

👉 Example output:

3.45.1 2024-01-30 ...

If you see “command not found”, install it using one of the methods below.


🍺 Step 2: Install Using Homebrew (Recommended)

If you use Homebrew (most common on Mac):

Install Homebrew (if not installed)

/bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh>)"

Install SQLite

brew install sqlite

Verify Installation

sqlite3 --version

📦 Step 3: Install via Official Binary (Alternative)

  1. Visit the official SQLite website

    👉 https://www.sqlite.org/download.html

  2. Download the Precompiled Binaries for macOS

  3. Extract the archive

  4. Move the binary to a system path (optional):

sudo mv sqlite3 /usr/local/bin/

▶️ Step 4: Start SQLite Terminal

Run:

sqlite3

You will enter the interactive SQLite shell:

SQLite version 3.xx.x
Enter ".help" for usage hints.
sqlite>