Skip to content

Commit 3596639

Browse files
Update the recommended way of choosing which Xcode to use. (#3081)
* Update the recommended way of choosing which Xcode to use. We're deprecating the MD_APPLE_SDK_ROOT variable and the setting files. References: * dotnet/macios#24021 * dotnet/macios-devtools#140 * Fix typo * Update docs/macios/includes/choose-xcode-version.md --------- Co-authored-by: Gerald Versluis <[email protected]>
1 parent de26ab0 commit 3596639

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

docs/macios/includes/choose-xcode-version.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@ ms.date: 03/19/2024
55

66
## Build with a specific version of Xcode
77

8-
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.
8+
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 there are two recommended approaches:
99

10-
> [!WARNING]
11-
> Using `xcode-select -s` to set the version of Xcode to use isn't recommended.
10+
1. Use `sudo xcode-select --switch ...` to choose the system's currently selected version of Xcode (this requires admin credentials). It's also possible to do this from inside Xcode (Settings -> Locations -> Command Line Tools).
1211

13-
To set the `MD_APPLE_SDK_ROOT` environment variable for the duration of the current terminal session:
12+
1. Use the `DEVELOPER_DIR` environment variable for the duration of the current terminal session:
1413

15-
1. Open the **Terminal** application.
16-
1. Type the following command, substituting in your version of Xcode, and press Enter:
14+
1. Open the **Terminal** application.
15+
1. Type the following command, substituting in your version of Xcode, and press Enter:
1716

18-
```zsh
19-
export MD_APPLE_SDK_ROOT=/Applications/Xcode_14.1.0.app
20-
```
17+
```zsh
18+
export DEVELOPER_DIR=/Applications/Xcode_14.1.0.app
19+
```
2120

22-
If you want to set this environment variable permanently, you can add the `export` command to your shell profile, such as *.zprofile*.
21+
If you want to set this environment variable permanently, you can add the `export` command to your shell profile, such as *.zprofile*.

docs/troubleshooting.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,15 @@ xcrun: error: unable to find utility "dsymutil", not a developer tool or in PATH
170170

171171
When building an app, .NET for iOS and .NET for Mac Catalyst use the following process to determine which version of Xcode to use:
172172

173-
1. If the `MD_APPLE_SDK_ROOT` environment variable is set, use its value.
174-
1. If the *~/Library/Preferences/Xamarin/Settings.plist* file exists, use the value defined inside it.
173+
1. If the `MD_APPLE_SDK_ROOT` environment variable is set, use its value. _This environment variable will be deprecated in a future release; do not use it._
174+
1. If the *~/Library/Preferences/Xamarin/Settings.plist* or *~/Library/Preferences/maui/Settings.plist* file exists, use the value defined inside it. _These files will be deprecated in a future release; do not use them._
175175
1. Use the value of `xcode-select -p`.
176176
1. Use `/Applications/Xcode.app`.
177177

178-
Therefore, the recommended approach to specifying the location of Xcode on your machine is to set the `MD_APPLE_SDK_ROOT` environment variable to the path of the Xcode version. For more information, see [Build with a specific version of Xcode](~/ios/cli.md).
178+
The recommended approach to specify the location of Xcode on your machine is to:
179179

180-
You can then safely delete *~/Library/Preferences/Xamarin/Settings.plist* from your machine.
180+
1. Delete *~/Library/Preferences/Xamarin/Settings.plist* or *~/Library/Preferences/maui/Settings.plist* files (if they exist).
181+
2. Either use `xcode-select --switch ...` to select the system's version of Xcode, or set the `DEVELOPER_DIR` environment variable to the path of Xcode. For more information, see [Build with a specific version of Xcode](~/ios/cli.md).
181182

182183
## Diagnose issues in Blazor Hybrid apps
183184

0 commit comments

Comments
 (0)