Skip to content

Instantly share code, notes, and snippets.

@oliverbenns
Last active February 7, 2020 11:24
Show Gist options
  • Save oliverbenns/1632e68db89827c7362dccbcccbcad59 to your computer and use it in GitHub Desktop.
Save oliverbenns/1632e68db89827c7362dccbcccbcad59 to your computer and use it in GitHub Desktop.
Hard clean react native
#!/bin/bash
# This script does a hard clean of caches and dependencies. It can be
# particularly useful when switching between branches with different
# native module packages or react native versions. It may take awhile to run.
printf "Cleaning cache\n"
rm -rf $TMPDIR/react-native-packager-cache-*;
rm -rf $TMPDIR/metro-bundler-cache-*;
printf "Reinstalling node modules\n"
rm -rf node_modules;
npm install;
printf "Cleaning ios\n"
rm -rf ~/Library/Developer/Xcode/DerivedData
pushd ios;
rm -rf Pods;
pod deintegrate && pod cache clean --all
pod install;
popd;
printf "Cleaning android\n"
pushd android;
./gradlew clean;
rm -rf .idea
popd;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment