#!/bin/bash # Check if we're in a "scripts" directory current_dir=$(basename "$PWD") if [ "$current_dir" = "scripts" ]; then echo "In scripts directory, moving to parent..." cd .. echo "Now in: $PWD" else echo "Not in a scripts directory. Current directory: $current_dir" fi set -e echo "๐Ÿ›‘ Killing Xcode and stuck PIF processes..." pkill -9 -f Xcode || true pkill -9 -f pif || true echo "๐Ÿ›ก๏ธ Clearing special flags on node_modules (macOS fix)..." chflags -R nouchg node_modules || true echo "๐Ÿงน Fixing node_modules permissions if needed..." chmod -R 777 node_modules || true echo "๐Ÿงน Deleting DerivedData, node_modules, and iOS build files..." rm -rf ~/Library/Developer/Xcode/DerivedData/* rm -rf node_modules ios/build ios/Pods ios/Podfile.lock echo "๐Ÿ“ฆ Reinstalling dependencies..." rm -rf node_modules #pnpm install bun install echo "๐Ÿ”ง Running Expo prebuild for iOS..." bun expo prebuild --platform ios echo "๐Ÿ“ฆ Installing CocoaPods..." cd ios pod install cd .. echo "๐Ÿš€ Reopening Xcode workspace..." open ios/Mentra.xcworkspace echo "โœ… All done. Clean rebuild ready."