MAUI Tutorials

.NET MAUI on macOS

Welcome to the macOS platform guide for .NET Multi‑Platform App UI (MAUI). This tutorial walks you through setting up a development environment on macOS, creating a MAUI app, leveraging macOS‑specific APIs, and publishing your app to the Mac App Store.

Setup macOS Development

  1. Install .NET SDK 8.0+.
  2. Install Visual Studio for Mac with the “.NET MAUI” workload.
  3. Ensure Xcode is installed (latest stable version) and command‑line tools are active:
    xcode-select --install
  4. Verify the MAUI workload:
    dotnet workload list

Project Structure

A typical MAUI solution includes the shared project and platform folders:

MyMauiApp/
├─ MyMauiApp.csproj
├─ Platforms/
│  ├─ MacCatalyst/
│  │  ├─ AppDelegate.cs
│  │  └─ Info.plist
│  ├─ iOS/
│  └─ Android/
├─ Resources/
│  ├─ Images/
│  └─ Fonts/
└─ MainPage.xaml

macOS‑specific Features

Using NSWindow

You can customize the native NSWindow from MAUI:

using Microsoft.Maui.Platform;
using AppKit;

public partial class App : Application
{
    protected override Window CreateWindow(IActivationState activationState)
    {
        var window = base.CreateWindow(activationState);
        var native = window.Handler.PlatformView as NSWindow;
        native.Title = "My MAUI macOS App";
        native.HasShadow = true;
        return window;
    }
}

Menu Bar Integration

Add a macOS menu bar item:

public static void AddMenu()
{
    var mainMenu = NSApplication.SharedApplication.MainMenu;
    var appMenu = new NSMenuItem { Title = "MyApp" };
    var submenu = new NSMenu();
    submenu.AddItem(new NSMenuItem("About MyApp", () => ShowAbout()));
    submenu.AddItem(NSMenuItem.SeparatorItem);
    submenu.AddItem(new NSMenuItem("Quit MyApp", "q", () => NSApplication.SharedApplication.Terminate(null)));
    appMenu.Submenu = submenu;
    mainMenu.AddItem(appMenu);
}

Packaging & Deployment

  1. Set the bundle identifier in Info.plist.
  2. Configure signing in Xcode or via Visual Studio signing settings.
  3. Publish:
    dotnet publish -f net8.0-maccatalyst -c Release /p:RuntimeIdentifier=osx-arm64
  4. Submit the generated .app bundle to the Mac App Store using Transporter.

Troubleshooting

Next steps: explore Android, iOS, and Windows platform guides.