Skip to content

Running Optimizely sites on macOS

While writing the series on the Move to .NET5, I started entertaining the idea of developing some Optimizely sites on my MacBook, since .NET is now macOS compatible.

I started looking at what I would need to configure to use my MacBook to build Optimizely sites.  This article will cover the steps I took and the pieces of software I needed to get an Optimizely development environment running on a mac.

 What is required

To get a running development environment, we would need the following pieces:

  • the dotnet framework and tools to be able work with the source code
  • an IDE
  • a SQL database

 Install the dotnet tools

The first thing to do is to install the dotnet framework tools to be able to scaffold, build and run a project.

You need to download and install the the dotnet package from the Microsoft site https://learn.microsoft.com/en-us/dotnet/core/install/macos.  The only thing you need to check before you download is the package version that is matching the architecture of your apple computer (Intel or M1 chip).

Once the package is installed, you will have access to all the same tools and command that you would have running on a windows-based workstation.

 The IDE

The next piece you would need is an IDE to help you develop your solution.  A good choice would be Visual Studio Code, which runs on a mac, and can be configured to run and debug a .NET application.

The must have extension to install is the C# for Visual Studio Code (powered by OmniSharp) extension which provide the following C# development features:

  • Editing support, including Syntax highlight and IntelliSence
  • Support the Optimizely project structure

It also allows you to install extensions that ease the front-end development process if you have to integrated with JavaScript framework of UI frameworks and libraries. Visual Studio and JetBrains Rider have versions available for the mac if you prefer IDE with more .NET coding integrated features.

 Using Docker to run the database

Once you have a running .NET setup, you will need to host the site database.  Since the database is running on an SQL server, you will need a way to host this server on mac.  If you have an Azure subscription, you could run it there.  If not, you can use Docker to run the SQL Server.

To have a running docker setup, you first need to install tools to manage your containers.

A good option is to use the Docker Desktop application

> It provides a simple interface that enables you to manage your containers, applications, and images directly from your machine without having to use the CLI to perform core actions.

https://docs.docker.com/desktop/

Once you have your tool to manage your containers, you need to download the SQL Server container image to your local machine.

The image you would download will be azure-sql-edge provided by Microsoft.

If you prefer to run Docker from the command line, here is a good guide to help you get setup.

https://database.guide/how-to-install-sql-server-on-an-m1-mac-arm64/

If you need to perform some queries on your database, a useful tool to use would be Azure Data Studio which has a version running on macOS.

If you are running on an M1 chip or later, there is one thing that you need to consider.

> For Apple Silicon users, please make sure you have Rosetta 2 installed. Some backend services are yet to be converted to native ARM64 binaries. You can run the following command in a Terminal window to install Rosetta 2.

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

Once installed, you need to configure a connection to your SQL server running inside docker.

So, those are the steps and configuration I used for most of the articles I wrote on the Move to .NET5 series.