-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Step 1: Create a scripts Directory
If you don’t already have a dedicated location for scripts, you can create one in your project directory or home directory:
mkdir -p ~/scriptsStep 2: Create the Script File
Inside this scripts directory (or another location of your choice), create a new file for the script:
touch ~/scripts/refresh_xcode.shStep 3: Edit the Script
Open the script file in a text editor to add the content:
nano ~/scripts/refresh_xcode.shCopy and paste the script content:
#!/bin/bash
echo "Cleaning Xcode build data and resolving package dependencies..."
# Clear DerivedData folder
rm -rf ~/Library/Developer/Xcode/DerivedData
# Clear SPM cache
rm -rf ~/Library/Caches/org.swift.swiftpm
# Open Xcode and resolve dependencies
xcrun xcodebuild -resolvePackageDependencies
echo "Done!"Save and close the editor.
Step 4: Make the Script Executable
Make the script executable so you can run it directly from the command line:
chmod +x ~/scripts/refresh_xcode.shStep 5: Run the Script
To execute the script, run:
~/scripts/refresh_xcode.shOptional: Add to PATH
To make it easier to run the script from anywhere, add the scripts directory to your PATH by adding this line to your shell profile (e.g., ~/.bashrc or ~/.zshrc):
export PATH="$PATH:~/scripts"Now, you can simply run:
refresh_xcode.shThis setup makes the script easily accessible and keeps it organized in a dedicated location.
Metadata
Metadata
Assignees
Labels
No labels