'How to use sqlite installed by Homebrew rather than the default
sqlite3 -version yields:
3.28.0 2019-04-15 14:49:49 378230ae7f4b721c8b8d83c8ceb891449685cd23b1702a57841f1be40b5daapl
However, brew upgrade sqlite3 yields:
Warning: sqlite3 3.37.2 already installed
So, there's clearly a disconnect. However, I can access the brew sqlite3 using /usr/local/opt/sqlite/bin/sqlite3 -version which yields:
3.37.2 2022-01-06 13:25:41 872ba256cbf61d9290b571c0e6d82a20c224ca3ad82971edc46b29818d5d17a0
So clearly I have the upgraded sqlite at that path. How do I set it to my system default, so I can just type in sqlite3 instead of /usr/local/opt/sqlite/bin/sqlite3?
Solution 1:[1]
The reason Homebrew does not override the default sqlite is because there is already a macOS default sqlite and overriding it may break the system in unexpected ways.
The doc for keg-only install suggests several ways of dealing with this.
A simple way to run the Homebrew version, is to invoke that sqlite version explicitly:
$(brew --prefix)/opt/sqlite/bin/sqlite3
You can also amend your PATH as described in the path modification section.
Note:
running brew upgrade sqlite3 only to check if a package is installed is risky since you may unintentionally upgrade the package.
It is safer to simply: brew list --versions sqlite
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
