{nbsp} +

Getting ready for Xamarin University with a Mac

Welcome to Xamarin University! This guide is to help you get your macOS development environment setup and ready to go before working through any of the Xamarin University materials. This will likely take at least an hour to complete so give yourself plenty of time to setup and validate your system.

If you have any trouble, the final half of XAM101 - Orientation and Welcome is devoted to 1:1 time with a trainer to solve setup issues. Just enroll in one of the upcoming classes and then you can get specific help from an expert.

In addition, we have a XAM101 FAQ which answers some common questions about setup and Xamarin University.

Hardware

Apple generally requires that you run the latest released version of macOS. As of Fall 2017, you should plan to get a Mac that can run Sierra and is on the supported list for macOS High Sierra. The machine should have a 64-bit Intel processor, 50GBs of free disk space, and a minimum of 4G of RAM; the more RAM the better. Avoid computers made prior to 2010 as they will likely not be sufficient to run the tools on.

Step-by-step instructions

The Xamarin documentation portal has detailed setup and install instructions for Xamarin.

The basics:

  1. Verify that your Mac is running the latest released version of macOS. You can get this information from About This Mac in the system menu as shown above.

  2. Make sure you have at least 40gb of free disk space. The IDE, simulator and emulator images and associated SDKs are all quite large.

  3. Install the latest version of XCode from the Mac App Store.

  4. Launch Xcode to accept the licensing agreements and download additional runtime files necessary for development.

  5. Install Visual Studio for Mac from www.visualstudio.com/d. The installer will automatically include any tools and SDKs needed for Android development. This may take a while depending on what is already installed on the computer since it may have to download fairly large SDKs.

  6. Launch Visual Studio for Mac It will be in your Applications folder; you can use Spotlight to locate and launch the application. We recommend keeping it in your Dock for quick access.

Xamarin update channels

In order to keep up with the rapidly changing mobile landscape, Xamarin updates the development platform quite frequently. There are three update channels available with Xamarin:

You can check or change which channel you are on using the Visual Studio for Mac > Check For Updates system menu option at any time.

Running mobile applications

As you design, build and run your applications, you will want to test them locally before making them available to the world. You have two choices for local testing:

  1. Testing with a physical device
  2. Testing on a simulated device

We recommend using physical devices when possible - these provide the best testing experience that will be as close to what your users will see. However, you likely don't have every possible variation of hardware and software available to test on, so you will need to turn to simulators and emulators to fully test your applications.

Just always keep in mind that simulators and emulators are not real devices, they often will be faster than a physical device (because they are running on your computer's hardware), don't expose all the features available (Bluetooth, NFC, etc.), and sometimes even use different runtime environments. Just because it runs on a simulator/emulator doesn't mean your app runs correctly on a real device - always test on both.

Testing with an iOS Device

You can run your applications on a physical iOS device plugged into your Mac using a USB cable. You must first configure the device for development purposes. The easiest way to do this is to use XCode – we have a video tutorial on how to do this with your device.

Testing with the iOS Simulator

The iOS Simulator is included as part of XCode and will be automatically launched by Visual Studio for Mac when you select a simulated device from the Visual Studio for Mac toolbar. You can choose which simulator to launch (iPhone vs. iPad, and iPhone variations) through this toolbar along the top of your Visual Studio for Mac IDE window:

By default, only the latest simulator is installed by Xcode, however you can also install other versions by launching Xcode and using the Preferences > Components dialog.

This is particularly important as Apple releases new versions of iOS; the simulator is not updated automatically - so you will need to use this dialog to install newer versions of iOS devices on your Mac.

Testing with an Android device

As mentioned above, it's recommended that you use a physical Android device for testing. This is often easier to setup, and gives a more realistic view of the end-user experience. The device must be plugged into your Mac through a USB cable and be setup for USB debugging. On Android KitKat (4.4) and above this requires a few steps.

Note that on some devices, the steps might vary slightly - if they don't match the instructions below, try searching for your specific vendor and turning on device debugging.

Testing with Android emulators

You can also use an emulator to test Android applications. We recommend the Android SDK emulators which are installed with Android Studio. These are hardware accelerated, kept up to date by Google and you can download images which have Google Play services pre-installed.

Note that you do not need to install an SDK version to make your app compatible with that version - Android supplies backward-compatible libraries to ensure it runs on older versions as long as you are compiling against the latest.

Create at least one modern Android Virtual Device

It's recommended to have at least one modern (version 7 or higher) Android Virtual Device (AVD) defined. You will want to test on each Android version you can run on to ensure your app works properly on each target. The most common variation is a phone form-factor, but if you are building for tablets, you can choose a larger emulated device as well.

Unfortunately, the AVD dialog is only available in an active project, so to access the wizard, you will need to generate a new project with Android Studio.

Verify your installation

To validate your Xamarin installation on a Mac, we will use Visual Studio for Mac to create a new Xamarin.Forms application and then run it on both iOS and Android to check both environments.

Start by creating a new Xamarin.Forms project. Open Visual Studio for Mac and use the New Project wizard: File > New Solution > Multiplatform > App > Forms App (Note: the newest versions of Visual Studio for Mac use the term “Multiplatform” here while previous versions used “Cross-platform”). You will use this to test your setup and make sure you can build and run both iOS and Android applications.

Testing iOS with Visual Studio for Mac

Testing Xamarin.Android with Visual Studio for Mac

Uninstalling Xamarin tools

You can uninstall Xamarin from your Mac using these instructions.

Troubleshooting

Most of the time, everything will install and run smoothly. However, if you have trouble with any of the steps, or you find that you cannot build or run the test application, check out our Troubleshooting Guide.