Reputation: 11238
I used the following to upgrade SQLite 3 on 10.6.8. I now have version 3.6.12 installed in /usr/bin/ and version 3.7.14 installed in /usr/local/bin/. Was this the best way to install it?
mkdir ~/tempFolder
cd ~/tempFolder
curl https://www.sqlite.org/sqlite-autoconf-3071400.tar.gz | tar xvz
cd sqlite-autoconf-3071400
autoconf
./configure
make
sudo make install
If not, what should I do to fix it? Lastly, SQLite 3.7.14 is only called when I enter its path /usr/local/bin/sqlite3. I have read that if I update the Path I can call the latest version by simply typing sqlite3 because it will look in /usr/local/bin/ first. I have also read articles that say I need to update .profile instead if I am not sending all commands throught the shell. What is the best method to call the latest version from both the shell and from AppleScript calls to the shell like this? Or would it be easier to simply have the latest version installed?
property databaseFolder : POSIX path of (path to public folder as text) & "Databases/"
property databaseName : "myDatabase"
property databasePath : quoted form of (databaseFolder & databaseName as text)
property table1 : "Main"
set xxx to do shell script "sqlite3 " & databasePath & " \"select * from " & table1 & "; \""
Upvotes: 4
Views: 11965
Reputation: 1
This is how I did it on my OSX Ventura (10.13.4):
I compiled my own sqlite3 from source from: https://www.sqlite.org/download.html
configure prefix=/usr/local
make ; sudo make install
Then added /usr/local/bin to my path.
Then added this to my .bashrc (this seems to do the trick):
export DYLD_LIBRARY_PATH=/usr/local/lib:/usr/lib
This is my test python program it shows that the sqlite3 module is using the version I compiled and installed in /usr/local:
import sqlite3
print(sqlite3.sqlite_version)
print(sqlite3.sqlite_version_info)
conn = sqlite3.connect(":memory:")
cursor = conn.cursor()
cursor.execute("select * from pragma_compile_options()")
x = cursor.fetchall()
print(x)
Upvotes: 0
Reputation: 361
Binary zip file may not be the best option. To upgrade my sqlite3 installation, i download the source bundle e.g. sqlite-snapshot-201707212031.tar.gz, untar it in temp folder, go there and do make, followed by 'make install'. To check the installation, run sqlite3 command and observe the version shown.
Upvotes: 0
Reputation:
Use the precompiled binary provided by SQLite. Unpack it and run it in the Terminal:
$ cd folder_where_sqlite3_was_unpacked
$ ./sqlite3
As an alternative, install SQLite from MacPorts. MacPorts ist useful to install a lot of Un*x tools, not only SQLite.
Upvotes: 3