Where does the iPhone Simulator store its data?

Viewed 190211

I have a SQLite DB that I'm using to store app data, and I could do with taking a look inside it to debug a problem I'm having - but where does the iPhone Simulator store its data, typically?

21 Answers

Easiest way ever.

  1. Catch a Breakpoint somewhere. (or Pause program execution (tap on pause in debug area) as Najdan Tomić mentioned on the comments)

  2. Enter po NSHomeDirectory() in console window

Result:

(lldb) po NSHomeDirectory() /Users/usernam/Library/Developer/CoreSimulator/Devices/4734F8C7-B90F-4566-8E89-5060505E387F/data/Containers/Data/Application/395818BB-6D0F-499F-AAFE-068A783D9753

Found it:

~/Library/Application Support/iPhone Simulator/User/

Where Xcode stores simulators & runtimes

Runtimes

$ open ~/Library/Developer/CoreSimulator/Profiles/Runtimes

For example: iOS 13.0, watchOS 6.0 These take the most space, by far. Each one can be up to ~5GB

Devices

$ open ~/Library/Developer/CoreSimulator/Devices

For example: iPhone Xr, iPhone 11 Pro Max. These are typically <15 mb each.

Explanation

Simulators are split between runtimes and devices. If you run $ xcrun simctl list you can see an overview, but if you want to find the physical location of these simulators, look in these directories I've shown.

It's totally safe to delete runtimes you don't support. You can reinstall these later if you want.

In iOS 5 :

/Users/[User Name]/Library/Application Support/iPhone Simulator/5.0/Applications/[AppGUID]/

For macOS Catalina, I found my db in:

~/Library/Developer/CoreSimulator/Devices/{deviceId}/data/Containers/Data/Application/{applicationId}/Documents/my.db

To get the applicationId, I just sorted the folders by date modified, though I'm sure there's a better way to do that.

I have no affiliation with this program, but if you are looking to open any of this in the finder SimPholders makes it incredibly easy.

For react-native users who don't use Xcode often, you can just use find. Open a terminal and search by with the database name.

$ find ~/Library/Developer -name 'myname.db'

If you don't know the exact name you can use wildcards:

$ find ~/Library/Developer -name 'myname.*'

Related