Is there a straightforward way to clean up the directory where xcode deploys an app when building for the iPhone simulator? I have a sqlite database that gets copied into t
for Xcode >= 6
xcrun simctl list | grep -oh '[A-Z0-9]\{8\}-[A-Z0-9]\{4\}-[A-Z0-9]\{4\}-[A-Z0-9]\{4\}-[A-Z0-9]\{12\}' | xargs -n1 xcrun simctl erase
What you are really trying to do is to clear out your database, if you've changed the schema. One way to do this, and it would make you happier in the long run when you start shipping version 2.0, 3.0, etc. of your app, is to check the version of your sqlite table, and if it has changed, then discard the old file and use the one in your bundle.
Finding a way to clean up the Simulator won't help the real world problem of how to clean up a customer's iPhone when you ship a new version with a new schema.
For extra points, after determining that you have encountered an old schema, you may want to copy the new database over without destroying the old one, and load any interesting data out of the old database, into the new one. Then blow away the old database. That way you can preserve your user's additions to the database.
As of Xcode 6, you can do this from the command line with: xcrun simctl erase
Also, the iOS Simulator app (both the Xcode 6 version and older versions) has a menu item called "Reset Content and Settings" that can be used to erase the currently booted device.