Skip to content

Instantly share code, notes, and snippets.

@dmolesUC
Last active June 13, 2024 15:18
Show Gist options
  • Save dmolesUC/fb5724e3eb5059a628f626c4c1082ecf to your computer and use it in GitHub Desktop.
Save dmolesUC/fb5724e3eb5059a628f626c4c1082ecf to your computer and use it in GitHub Desktop.
Installing sqlite3-pcre on macOS
  1. Decide where you're going to put the compiled library, e.g. ~/lib. We'll call this <target-dir> below.

  2. Clone ralight/sqlite3-pcre

  3. Ensure pcre is installed (brew install pcre).

  4. In the sqlite3-pcre directory, compile with:

    cc \
      -shared \
      -o <target-dir>/sqlite3-pcre.so \
      -I/usr/local/opt/pcre/include \
      -fPIC \
      -W \
      -Werror \
      pcre.c \
      -L/usr/local/opt/pcre/lib \
      -lpcre
  5. Add the following to ~/.sqliterc:

    .load '<target-dir>/lib/sqlite3-pcre.so'
    

Note that neither environment variables nor shell expansions such as ~/ can be used in .sqliterc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment