Cleaning up the iPhone simulator

The way I do this is to simply click and hold on the icon for my app in the simulator--then when it starts to wiggle click the black and white (x). A message will pop up asking whether you really want to delete and you just click yes. The next time you build and deploy your app it will use the new sqlite db without a hitch and you don't have to go muck around in the filesystem.


After iOS 5 on Mac OS X Lion, you can try:

  1. Create a script called RemoveSimulatorApps.command that contains:
    rm -rf "$HOME/Library/Application Support/iPhone Simulator/5.0/Applications/*"
    
  2. Save this script to a directory in your PATH.
  3. Make the file executable, such as:
    chmod +x RemoveSimulatorApps.command

Assumptions

  • You may want to invoke this from a keyboard favorites buttons, such as on a Logitech or Microsoft keyboard with programmable keys (hence, saving it as a .command file instead of say, .sh)
  • You are okay with blowing away everything in the iOS simulator (ideal if you're just actively working on one app)
  • All the notes from others apply about being a good upgradable app etc. (I personally found this useful nonetheless b/c I have development mode switches that reload a database in a specific state I was trying to do some consistent robustness/error handling on)

The simulator installs apps into:

"$HOME/Library/Application Support/iPhone Simulator/User/Applications"

Also check:

"$HOME/Library/Developer/CoreSimulator/Devices"

The GUID files and directories match up to the simulator's installed apps.

Manually delete all those files/directories to remove all applications from the simulator.

I know there is some way to add scripts to the build process in XCode.

Also it looks as if XCode changes the GUID it uses each build (the directory where my app sits changes between builds in XCode), so trying to delete the same directory all the time won't work. If you are only working on one app at a time then clearing out the entire directory would be an option.


From Apples Dev Resources:

To set the user content and settings of the simulator to their factory state and remove the applications you have installed, choose Device > Erase All Content and Settings.

(On older versions: iPhone Simulator > Reset Content and Settings.)