clear_data
This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET
Delete an app's data and leave it installed — the state of a fresh install, without reinstalling. These call app_clear_data.
clear_data
def clear_data(app: str, bundle: str | None=None) -> dict
Delete an app's data and leave it installed — a fresh install's state, without reinstalling.
Returns what was read back empty (emptied), what was kept
(kept) and, on Android, the runtime permissions still granted
(still_granted): pm clear revokes what the user granted. An iOS
simulator keeps its privacy grants and keychain.
A real iPhone cannot clear in place: pass the app's own bundle, a
.app or .ipa, and it is uninstalled and installed again. Its data
container is read back empty, and its permissions, which nothing
outside the app can read, are listed in not_read_back. Without a
bundle a phone refuses, and with one any other device does.
Examples
Delete an app's data, and keep it installed
result = device.clear_data("com.example.shop")
print(result["emptied"])