Skip to content

Instantly share code, notes, and snippets.

@gtfunes
Created March 9, 2020 16:21
Show Gist options
  • Save gtfunes/8963d7bf2a7d50536d9772ae7d0fcfd0 to your computer and use it in GitHub Desktop.
Save gtfunes/8963d7bf2a7d50536d9772ae7d0fcfd0 to your computer and use it in GitHub Desktop.
Bash script to remove all caches related to a react-native project and reinstall all dependencies
#!/bin/bash
# - Clears app caches, run from project root -
echo -e "Removing caches...\n"
rm -rf node_modules
rm -rf ios/build
rm -rf ios/Pods
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-*
watchman watch-del-all
npm cache clean --force && npm cache verify
cd ios && pod deintegrate && pod cache clean --all && cd ..
echo -e "\nInstalling NPM dependencies...\n"
npm i
echo -e "\nInstalling Pod dependencies...\n"
cd ios && pod install && cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment