Skip to content

Instantly share code, notes, and snippets.

@jasonm
Last active February 13, 2017 13:24
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jasonm/5aa9406c88e29e3d550c1b42f9435cf2 to your computer and use it in GitHub Desktop.
Save jasonm/5aa9406c88e29e3d550c1b42f9435cf2 to your computer and use it in GitHub Desktop.

See what your original version of sqlite is:

$ sqlite3 --version
3.8.5 2014-08-15 22:37:57 c8ade949d4a2eb3bba4702a4a0e17b405e9b6ace

Confirm that your version has the bug:

$ curl -s https://gist.githubusercontent.com/jasonm/0a81d646f2af7d43baa322a92414a057/raw/844edd54e6ced8be707caa7b326221985f77f384/1-sqlite-bug-repro-script.sql | sqlite3
250
250
Segmentation fault: 11

Update sqlite3 from homebrew:

$ brew update
Already up-to-date.
$ brew install sqlite3
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.14.0.yosemite.bottle.tar.gz
Already downloaded: /Users/jason/Library/Caches/Homebrew/sqlite-3.14.0.yosemite.bottle.tar.gz
==> Pouring sqlite-3.14.0.yosemite.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

OS X provides an older sqlite3.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/sqlite/lib
    CPPFLAGS: -I/usr/local/opt/sqlite/include

==> Summary
🍺  /usr/local/Cellar/sqlite/3.14.0: 10 files, 2.9M

And link it:

$ brew link sqlite3 --force
Linking /usr/local/Cellar/sqlite/3.14.0... 8 symlinks created

Open a new terminal or re-source your ~/.bash_profile and confirm the new version:

$ source ~/.bash_profile
$ sqlite3 --version
3.14.0 2016-08-08 13:40:27 d5e98057028abcf7217d0d2b2e29bbbcdf09d6de

Confirm that the new version is not affected by the bug:

$ curl -s https://gist.githubusercontent.com/jasonm/0a81d646f2af7d43baa322a92414a057/raw/844edd54e6ced8be707caa7b326221985f77f384/1-sqlite-bug-repro-script.sql | sqlite3
250
250
$ echo $?
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment