Using OR-Tools NuGet for .Net


This guide gets you started with OR-Tools in .Net with a simple working example.

Although these instructions might also work on other MacOS variants, we have only tested them on machines meeting the following requirements:

  • MacOS 13.0.1 (Ventura) Intel 64-bit (x86_64)
  • MacOS 13.0.1 (Ventura) M1 (arm64)


The following sections describe the prerequisites for installing OR-Tools.

Xcode Command Line Tools

You must install the Xcode Command Line Tools. To do so, open the Terminal, found in /Applications/Utilities/, and enter:

xcode-select --install

Click “Install” to download and install Xcode Command Line Tools. You don’t need to "Get Xcode" from the App Store. If you have a slow Internet connection, it may take many minutes.

Verify that you’ve successfully installed Xcode Command Line Tools:

xcode-select -p

You should see:



To install the remaining prerequisites, we recommend first installing the "missing package manager for macOS" otherwise known as Homebrew. To do so, open a terminal window and enter:

/bin/bash -c "$(curl -fsSL"
brew update

To verify that you’ve successfully installed brew:

brew --version

You should see:

Homebrew 1.6.9-8-g25542d7
Homebrew/homebrew-core (git revision 0e0c84; last commit 2018-06-20)

.Net 6.0 SDK

You must install the .Net 6.0 SDK.

Once you have installed Homebrew, you can install the dotnet-sdk package by opening a terminal window and enter:

brew cask install dotnet-sdk

You can test dotnet cli is correctly installed using the following command:

dotnet --info

Get the .Net example code

The example code is located in the dotnet_or-tools repository.

  1. Download the repository as a zip file and extract it, or clone the repository:

    git clone -b v9.9 --depth 1
  2. Change to the examples directory:

    cd dotnet_or-tools

Build the example

From the dotnet_or-tools directory:

Build the project using:

dotnet build -c Release

Run the example

From the dotnet_or-tools directory:

Run the binary using:

dotnet run -c Release

Congratulations! You've just run an application with OR-Tools, you are ready to get started with OR-Tools.