Walkthrough: Running a Cross-Platform Web Application on OS X

This walkthrough shows how to run an ASP.NET 5 web application on a Mac running OS X.

Prerequisites

The following prerequisites are required and will be installed as part of the walkthrough.

  • .NET Version Manager (DNVM)

  • .NET Core and ASP.NET 5

  • The Parts Unlimited sample application.

Install and run

The procedures in this section will set up everything you need on the Mac OS and on Azure.

Download the sample application

  1. Download the Mac tarball here.

  2. Open Terminal and run tar zxvf <path to the downloaded PartsUnlimited-demo-app-darwin.tar.gz file> -C ~/ to extract the contents.

Install prerequisites on Mac OS X

  1. Install Homebrew if it’s not already installed. Open Terminal and enter:

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    

    The installer will inform you of the steps it is taking and pause before proceeding. You can learn more about Homebrew here.

  2. Install .NET Execution Environment (DNX). In Terminal enter sudo brew tap aspnet/dnx.

    If prompted, enter your password.

  3. Enter sudo brew update.

  4. Install .NET Version Manager (DNVM). In Terminal, enter brew install dnvm.

  5. Enter source dnvm.sh.

  6. Enter dnvm use 1.0.0-beta5-11624 –r coreclr –arch x64.

Run the application

  1. In Terminal, enter ~/demo/Kestrel and waited for the Started prompt.

  2. Open Safari and enter the URL https://localhost:5004/.

    Scroll to the bottom of the page and note the banner stating “Site powered by OS X Yosemite and running on CoreCLR 1.0.0-beta5-11633”.

Next Steps

The CoreCLR for cross-platform development is still in an early preview stage with many more changes to come. If you want to try out other scenarios, you can create your own ASP.NET app using Visual Studio Code for OS X, or run an ASP.NET app on a Linux server (See Walkthrough: Creating a Cross-Platform Web Application using Visual Studio).

See Also

Other Resources

Create Cross-Platform .NET Apps