Before continuting to the next step, let's clear some nuget caches that might get in the way.
dotnet nuget locals all --clear
This should also free up GIGABYTES of disk space.
This step will require you to delete all your previous .NET installations. Trust me, it's better this way. If you're not sure where your .NET installation folder is on macOS, then you can run the following command in a terminal.
which dotnet
The output is likely going to be /usr/local/share/dotnet/dotnet
. You'll want to run the following command to delete dotnet
from your instance.
sudo rm -rf /usr/local/share/dotnet
Next, head to https://dot.net and download .NET 7 and if you need it for other projects, remember to download the other SDKs as well.
⚠️ Important Be sure you're running the7.0.100-rc.2
SDK. Workloads install to the SDK version band you are using.
Run the following commands from a terminal. Be sure you're using the .NET 7 SDK by running dotnet --version
. If you see anything other than .NET 7 you probably have a global.json
file somewhere forcing the SDK version.
sudo dotnet workload install maui
sudo dotnet workload install maui-android maui-ios maui-maccatalyst
sudo dotnet workload install ios android maccatalyst
Running dotnet workload list
will give you the following results.
dotnet workload list
Installed Workload Id Manifest Version Installation Source
---------------------------------------------------------------------------------------
maui-maccatalyst 7.0.0-rc.2.6866/7.0.100-rc.2 SDK 7.0.100-rc.2
maui-ios 7.0.0-rc.2.6866/7.0.100-rc.2 SDK 7.0.100-rc.2
maui-android 7.0.0-rc.2.6866/7.0.100-rc.2 SDK 7.0.100-rc.2
ios 16.0.1271-rc.2-xcode14/7.0.100-rc.2 SDK 7.0.100-rc.2
maccatalyst 15.4.1186-rc.2/7.0.100-rc.2 SDK 7.0.100-rc.2
android 33.0.0-rc.2.202/7.0.100-rc.2 SDK 7.0.100-rc.2
Use `dotnet workload search` to find additional workloads to install.
You'll need to install the Xamarin-macios
package found on this GitHub repository. https://github.com/xamarin/xamarin-macios/blob/main/DOWNLOADS.md.
🗒️ Note Be sure the package version 16.0.0.x or higher
You'll need XCode 14 installed and the Android SDKs 33+. If you're using JetBrains Rider you can use the environment tools to manage these settings.
- https://developer.android.com
- Download XCode from the AppStore or try this tool (https://github.com/xcpretty/xcode-install)
You'll want to create a new MAUI Hello World app.
dotnet new maui -o HelloMaui
cd HelloMaui
dotnet restore
dotnet build
If everything went well, then you should have a functioning MAUI app. Try running the following command.
dotnet build -t:Run -f net7.0-maccatalyst
You should see a MAUI-powered macOS app running.
- If you're getting strange errors, double check your
.csproj
file. IfTargetFrameworks
isn't7.0
then you likely used an old template. Clear your nuget cache and reinstall .NET. - You need devices for Android and iOS. Be sure you have the latest SDKs for both.