-
Verify Flutter Installation
Check if Flutter is installed and accessible in the current environment.
Decision Logic:
- If the command fails, STOP AND ASK THE USER: "Flutter is not installed or not in your PATH. Please install Flutter and add it to your PATH before continuing."
- If the command succeeds, proceed to step 2.
-
Verify Xcode Installation
Ensure Xcode is installed on the macOS system.
Decision Logic:
- If Xcode is not installed, STOP AND ASK THE USER: "Xcode is required for macOS Flutter development. Please install the latest version of Xcode from the Mac App Store and notify me when complete."
- If Xcode is installed, proceed to step 3.
-
Configure Xcode Command-Line Tools
Link the Xcode command-line tools to the installed version of Xcode and run the first-launch setup.
STOP AND ASK THE USER: "I need to configure Xcode command-line tools. This requires administrative privileges. Please run the following command in your terminal and confirm when done:"
bash
sudo sh -c 'xcode-select -s /Applications/Xcode.app/Contents/Developer && xcodebuild -runFirstLaunch'
(Note: If the user installed Xcode in a non-standard directory, instruct them to replace with their custom path).
-
Accept Xcode Licenses
The Xcode license agreements must be accepted before compilation can occur.
STOP AND ASK THE USER: "Please run the following command to review and accept the Xcode license agreements:"
bash
sudo xcodebuild -license
-
Install CocoaPods
CocoaPods is required for Flutter plugins that utilize native macOS code.
Check if CocoaPods is installed:
Decision Logic:
- If installed, proceed to step 6.
- If not installed, instruct the user to install it (e.g., via Homebrew or RubyGems) and verify the installation.
bash
sudo gem install cocoapods
-
Validate Setup (Validate-and-Fix Loop)
Run the Flutter diagnostic tool to check for any remaining macOS toolchain issues.
Decision Logic:
- Analyze the output under the Xcode section.
- If there are errors or missing components, identify the specific missing dependency, provide the user with the exact command to fix it, and re-run .
- Repeat this loop until the Xcode section reports no issues.
-
Verify Device Availability
Ensure Flutter can detect the macOS desktop as a valid deployment target.
Verify that at least one entry in the output has "macos" listed as the platform. If it is missing, instruct the user to enable macOS desktop support:
bash
flutter config --enable-macos-desktop