Skip to main content
Version: Next

Uninstalling Detox

Uninstalling Detox

Installing and using Detox implies certain side effects: cloned devices, cache files, state files, temporary files, etc.

This checklist might come in handy whenever you have to make a clean uninstallation after using Detox.

Detox Framework Cache

Every npm install detox also has a postinstall phase, which builds (or unpacks) Detox.framework into ~/Library/Detox.

You can either delete the folder manually:

rm -rf ~/Library/Detox

or run:

detox clean-framework-cache

Test Session State

On every test run, Detox rewrites a few temporary files in DETOX_LIBRARY_ROOT_PATH, i.e.:

  1. The respective iOS and Android lockfiles to tell apart the busy and the available devices for use with multiple workers:
    • device.registry.state.lock
    • android-device.registry.state.lock.
  2. A plain text file with the line-separated list of last failed test files to rerun via -R <retries-count> CLI feature:
    • last-failed.txt.

The location of DETOX_LIBRARY_ROOT_PATH may vary depending on the operating system:

  • macOS:
    • ~/Library/Detox.
  • Linux:
    • $XDG_DATA_HOME/Detox, if $XDG_DATA_HOME is defined;
    • ~/.local/share/Detox, otherwise.
  • Windows:
    • %LOCALAPPDATA%\data\Detox, if %LOCALAPPDATA% is defined;
    • %USERPROFILE%\Application Data\Detox, otherwise.

Cloned Simulators (macOS)

To support the "multiple workers" feature on iOS, Detox clones simulator instances when there aren’t enough available ones. The autogenerated simulators have names with -Detox suffix appended, so you can easily spot them with:

xcrun simctl list | grep "-Detox"

To delete a simulator, you can use:

xcrun simctl delete <uuid>

Remnants of Artifacts

Forced exits may result in leaving some temporary files behind.

iOS

To ensure there are no temporary artifact files (logs, screenshots, etc.), you can run:

rm -rf $TMPDIR/*.detox.*

If you wish to clean up your iOS simulators from the installed apps and other customizations, just run the erase procedure for the relevant ones:

xcrun simctl erase <uuid>

Android

The advice for iOS applies to the Android virtual devices as well. To wipe user files on a specific AVD, run:

emulator -avd <your_AVD> -wipe-data

If you have to clean temporary Detox files from an individual booted device, look out for files like 11159175_0.log in /sdcard folder. You can try deleting them using a simple wildcard like below or use your own:

adb -s <emulator-port> shell rm -rf /sdcard/*_*.* 

Detox CLI

If you have installed the official CLI wrapper for Detox, then make sure to uninstall it as well:

npm uninstall -g detox-cli