Skip to content

Instantly share code, notes, and snippets.

@anuragajwani
Created March 9, 2017 22:08
Show Gist options
  • Save anuragajwani/90d088de14ea550c564772b8b21b539c to your computer and use it in GitHub Desktop.
Save anuragajwani/90d088de14ea550c564772b8b21b539c to your computer and use it in GitHub Desktop.
#!/bin/bash
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
FILE_PATH=$(realpath $0)
# File directory path
DIR_NAME=$(dirname "${FILE_PATH}")
# Xcode process id
XCODE_PID=$(pgrep Xcode)
if [ ! -z "$XCODE_PID" ]; then
kill $XCODE_PID
else
echo "XCode was not running"
fi
# Remove derived data
rm -rf ~/Library/Developer/Xcode/DerivedData
# Remove pod generated content
cd ${DIR_NAME}
cd .. # Move to project root or where your Podfile lives
rm -rf Pods
rm Podfile.lock
XCWORKSPACE=$(find . -name "*.xcworkspace")
rm -rf ${XCWORKSPACE}
pod install
open -a Xcode ${XCWORKSPACE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment