I’m trying to build a Flutter app that targets macOS. After adding some dependencies, like just_audio, I am given warnings regarding MACOSX_DEPLOYMENT_TARGET
in various locations being set to various values which need to be changed to some other value.
So, I open Xcode and studiously set the values as instructed. After that the app compiles successfully without warnings and performs as expected once, twice, maybe even three times, but inevitably the warnings will return. When I go back into Xcode I find that all of the values have reverted back to what they were before. I’ve tried different target versions, from 10.15 up to 13.1 (currently installed), but the warnings always come back eventually.
Am I missing an important step? I’m not new to software development, but I am completely new to macOS and Xcode.
Here’s a sample of the errors that keep coming back:
Launching lib/main.dart on macOS in debug mode...
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006000-000210D03EB8401E }
{ platform:macOS, arch:x86_64, id:00006000-000210D03EB8401E }
/Users/foo/projects/just_audio_background_test/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.6, but the range of supported deployment target versions is 10.13 to 13.1.99. (in target 'FMDB' from project 'Pods')
/Users/foo/projects/just_audio_background_test/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.11, but the range of supported deployment target versions is 10.13 to 13.1.99. (in target 'sqflite' from project 'Pods')
/Users/foo/projects/just_audio_background_test/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.11, but the range of supported deployment target versions is 10.13 to 13.1.99. (in target 'audio_session' from project 'Pods')
/Users/foo/projects/just_audio_background_test/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.12.2, but the range of supported deployment target versions is 10.13 to 13.1.99. (in target 'audio_service' from project 'Pods')
/Users/foo/projects/just_audio_background_test/macos/Runner.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.11, but the range of supported deployment target versions is 10.13 to 13.1.99. (in target 'Flutter Assemble' from project 'Runner')
/Users/foo/projects/just_audio_background_test/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.11, but the range of supported deployment target versions is 10.13 to 13.1.99. (in target 'FlutterMacOS' from project 'Pods')
Here’s my flutter doctor
output:
[✓] Flutter (Channel stable, 3.3.10, on macOS 13.1 22C65 darwin-arm, locale en-TW)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.74.1)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
2
Answers
The reason is because flutter will perform
pod install
when you try to run or build. So edit yourpost_install
inPodfile
like below.The code added will force the deployment target to 10.13 when flutter executes
pod install
.Full Example is below
A more robust solution than the answer above is this:
Based on this answer to a similar question for iOS.