diff --git a/docs/ios/cli.md b/docs/ios/cli.md index 08e84eb1..9293e6b1 100644 --- a/docs/ios/cli.md +++ b/docs/ios/cli.md @@ -27,6 +27,8 @@ In this tutorial, you'll learn how to create and run a .NET Multi-platform App U +[!INCLUDE [choose Xcode version](~/macios/includes/choose-xcode-version.md)] + ## Launch the app on a specific simulator A .NET MAUI iOS app can be launched on a specific iOS simulator from a Mac by providing its unique device id (UDID): diff --git a/docs/mac-catalyst/cli.md b/docs/mac-catalyst/cli.md index bcd2e443..78510af1 100644 --- a/docs/mac-catalyst/cli.md +++ b/docs/mac-catalyst/cli.md @@ -32,3 +32,5 @@ In this tutorial, you'll learn how to create and run a .NET Multi-platform App U :::image type="content" source="media/cli/maccatalyst-running-app.png" alt-text=".NET MAUI app running on Mac."::: + +[!INCLUDE [choose Xcode version](~/macios/includes/choose-xcode-version.md)] diff --git a/docs/macios/includes/choose-xcode-version.md b/docs/macios/includes/choose-xcode-version.md new file mode 100644 index 00000000..da552b35 --- /dev/null +++ b/docs/macios/includes/choose-xcode-version.md @@ -0,0 +1,22 @@ +--- +ms.topic: include +ms.date: 03/19/2024 +--- + +## Build with a specific version of Xcode + +If you have multiple versions of Xcode installed on your Mac, it's possible to specify which Xcode version should be used when building your app. There are a number of approaches that can be used to accomplish this, but the recommended approach is to set the `MD_APPLE_SDK_ROOT` environment variable to the path of the Xcode version. + +> [!WARNING] +> Using `xcode-select -s` to set the version of Xcode to use isn't recommended. + +To set the `MD_APPLE_SDK_ROOT` environment variable for the duration of the current terminal session: + +1. Open the **Terminal** application. +1. Type the following command, substituting in your version of Xcode, and press Enter: + + ```zsh + export MD_APPLE_SDK_ROOT=/Applications/Xcode_14.1.0.app + ``` + +If you want to set this environment variable permanently, you can add the `export` command to your shell profile, such as *.zprofile*.