Xcode
Install and configure Xcode for iOS development and simulator management
What is Xcode?
Xcode is Apple’s integrated development environment (IDE) for macOS, which is used for compiling and building iOS apps to be tested on iOS simulators and real Apple iPhones.
Installation
Full Install (Recommended)
Download Xcode from the App Store.
Developer Tools Only
If you only need the command-line developer tools:
xcode-select --install
Click to install the Xcode developer tools when prompted.
Ensure Required Simulators are Installed
- Open Xcode
- Click on Xcode in the top left corner
- Click on Preferences (Xcode 13 and earlier) or Settings (Xcode 14+)
- Select the Platforms tab
- Select the simulators you want to have installed
- Click on the GET button next to the name of the simulator
By default, only simulators with the latest available OS are available.
Ensure Command Line Tools are Installed
- Open Xcode
- Click on Xcode in the top left corner
- Click on Preferences (Xcode 13 and earlier) or Settings (Xcode 14+)
- Click on Locations
- Check that the Command Line Tools dropdown is not empty
- It should show something like
Xcode <version>
- It should show something like
If you see “(No Xcode Selected)” under the dropdown list even though you’ve already selected something, simply re-select the item in the dropdown and it should update.
Verify Installation
Open a new terminal session:
xcode-select -p
# Should output: /Applications/Xcode.app/Contents/Developer
xcodebuild -version
# Should output: Xcode <version> Build version <build>
List Available Simulators
xcrun simctl list devices
Troubleshooting
”xcode-select: error: tool ‘xcodebuild’ requires Xcode”
After installing Xcode, you need to accept the license and select the tools path:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
Command Line Tools Missing After macOS Update
macOS updates can reset the Xcode configuration:
# Reinstall command line tools
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
Simulator Not Appearing
- Open Xcode > Preferences (Xcode 13 and earlier) or Settings (Xcode 14+) > Platforms
- Download the required simulator runtime
- Verify it appears:
xcrun simctl list devices available
“Unable to boot device in current state: Booted”
The simulator is already running. Reset if needed:
# Shutdown all simulators
xcrun simctl shutdown all
# Or reset a specific simulator
xcrun simctl erase <device-udid>
Build Errors with “Signing Certificates”
For iOS real device testing:
- Open Xcode
- Go to Preferences (Xcode 13 and earlier) or Settings (Xcode 14+) > Accounts
- Add your Apple ID
- Download manual provisioning profiles or enable automatic signing
Disk Space Issues
Xcode can consume significant disk space. Clean up:
Caution: The
rm -rfcommands below permanently delete files.
~/Library/Developer/Xcode/DerivedDatacontains build caches that can be regenerated by Xcode on the next build.~/Library/Developer/Xcode/Archivescontains signed release archives that cannot be regenerated. Back up any important Archives before deleting them, and consider reviewing the folder contents manually instead of runningrm -rfblindly.
# Remove old simulators
xcrun simctl delete unavailable
# Remove derived data (safe — will be regenerated on next build)
rm -rf ~/Library/Developer/Xcode/DerivedData
# Remove old archives (DANGER — cannot be regenerated)
# Review contents first: ls ~/Library/Developer/Xcode/Archives
# Back up important archives before running this command
rm -rf ~/Library/Developer/Xcode/Archives
Resources
Official Xcode page with features and documentation
Complete Xcode documentation from Apple