See how to pair your Windows OS to your Mac for seamless native iOS development.
Do I need a Mac to develop my iOS apps in .NET MAUI? This is one of the most common questions when people start cross-platform development in .NET MAUI.
In this article we will learn about the different answers to this question. And, once you know them, we will be focusing on pairing to Mac from Windows for when you prefer to continue using Windows as your main operating system.
Building native iOS apps in .NET MAUI requires access to Apple’s build tools. There are different options to get such access, including:
We have two ways to do this pairing process—automatic or manual. Both ways have most of the steps in common, so I will explain them together. When a step must be done differently for the manual way, I will identify it with the label “If you want to do it manually.”
You will see a set of instructions that will guide you through pairing your Mac with Windows. Each of these instructions will be divided into steps. And it will be structured around the following topics:
Let’s look at each of these steps!
From your Mac: To set up the Mac build host, you must apply the following instructions:
As I show you in the image below:
Once you click the Sharing panel, a box with different options will be displayed. You need to apply the following steps:
⚠ If you want to do it manually: You only have to obtain your IP or your Mac name, which you can do it in two ways:
ipconfig getifaddr en0
From your Windows computer: Open a project in your Visual Studio 2022 (it can be a new or existing one), and apply the following steps:
Once you’ve clicked, a list of all previously connected and currently available Mac build hosts will be displayed. Among the available ones you will be able to see your Mac. Select it and then click on the Connect option located in the lower right part of the box as you will see below:
⚠ If you want to do it manually: Click on the Pair Mac button, and add the IP we got earlier in Step One.
A dialog will be displayed in which you have to enter your username and your password:
Once your Mac is connected, you will identify it with an indicator icon as shown below:
And done! Our pairing process was successful! 🎉 From now on, you can run your iOS apps on Windows without any problems!
📋 Keep in mind the following points:
You can also create applications from the command line. You just have to go to the Terminal and locate in your App folder and execute the following command:
dotnet build -f:net7.0-ios /p:ServerAddress={macOS build host IP address} /p:ServerUser={macOS username} /p:ServerPassword={macOS password} /p:TcpPort=58181 /p:_DotNetRootRemoteDirectory=/Users/{macOS username}/Library/Caches/Xamarin/XMA/SDKs/dotnet/
But what do these parameters mean? Let’s explore them!
📋 The first time you pair with Mac logs into a Mac build host from Visual Studio 2022 or the command line, it sets up SSH keys. This means that future logins will not require your credentials.
Newly created keys are stored in %LOCALAPPDATA%\Xamarin\MonoTouch path.
That’s all! 🎊 You already know how to start programming your iOS applications in .NET MAUI from Windows!
Thanks for reading this article! 💚💕 See you next time! 🙋♀️
Reference: https://learn.microsoft.com/en-us/dotnet/maui/ios/pair-to-mac?view=net-maui-7.0
Use a component library in sync with .NET MAUI’s release cadence. Try Telerik UI for .NET MAUI for free.
Leomaris Reyes is a Software Engineer from the Dominican Republic, with more than 5 years of experience. A Xamarin Certified Mobile Developer, she is also the founder of Stemelle, an entity that works with software developers, training and mentoring with a main goal of including women in Tech. Leomaris really loves learning new things! 💚💕 You can follow her: Twitter, LinkedIn , AskXammy and Medium.