Find sqlite location

Te find the sqlite location for your iOS simulator, you first have to know the simulators uid. To see all available simulators and their device UIDS:

/Applications/Xcode.app/Contents/Developer/usr/bin/simctl list

The sqlite location is:

~/Library/Developer/CoreSimulator/Devices/<device-id>/data/Containers/Data/Application/<application-id>/Library/Private Documents/<db>.sql

Unfortunately it's (as far as I know) not possible to get the application id. If you know the name of the sqlite file, then it's easier to find it. First go to ~/Library/Developer/CoreSimulator/Devices/<device-id>/data/Containers/Data/Application and do:

find . -name <name_of_file.sql>

Or if you want look for files that have been accessed within one hour:

find . -amin -60 -name <name_of_file.sql>

If you don't want to write this down every time, you can create a simple bash script I called sqlitebrowser:

DB=`find . -name ${1}`
"/Applications/DB Browser for SQLite.app/Contents/MacOS/DB Browser for SQLite" "${DB}"

Now you can call this script with just the name of the database:

sqlitebrowser mydb.sql
Tag: | Category: