Skip to content

Instantly share code, notes, and snippets.

@janfri
Last active October 29, 2023 22:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janfri/a3e61731864a63554ba6f32bdc7179aa to your computer and use it in GitHub Desktop.
Save janfri/a3e61731864a63554ba6f32bdc7179aa to your computer and use it in GitHub Desktop.
Install sqlite-pcre on OSX
brew install sqlite pcre
git clone https://github.com/ralight/sqlite3-pcre.git
cd sqlite3-pcre
cc -shared -o pcre.so -I/usr/local/opt/pcre/include -fPIC -W -Werror pcre.c -L/usr/local/opt/pcre/lib -lpcre
echo ".load '`pwd`/pcre.so'" >> ~/.sqliterc
@ScottA38
Copy link

ScottA38 commented Feb 3, 2022

Typo in intall. Also even after this I get 'Error: no such function: REGEXP'

@janfri
Copy link
Author

janfri commented Feb 7, 2022

Thanks for the hint to the typo.

On my system it works.

@lbe
Copy link

lbe commented Aug 14, 2022

When using the cc command above, I received the error ld: symbol(s) not found for architecture x86_64

Some research indicated that I also needed -lsqlite3

The following command worked

cc -shared -o pcre.so -I/usr/local/opt/pcre/include  -fPIC -W -Werror pcre.c -L/usr/local/opt/pcre/lib -lpcre -lsqlite3

@loretoparisi
Copy link

on macOS 14 Sonoma you need to explicit the path for pcre after brew install (or update):

cc -shared -o pcre.so -I/usr/local/opt/pcre/include  -fPIC -W -Werror pcre.c -L/opt/homebrew/Cellar/pcre/8.45/ -lpcre -lsqlite3

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