Sponsored by Microsoft, Mono is an open source implementation of Microsoft's.NET Framework based on the ECMA standards for C# and the Common Language Runtime.A growing family of solutions and an active and enthusiastic contributing community is helping position Mono to become the leading choice for development of cross platform applications. Apple TV (running on the Mono runtime) Apple Watch (running on the Mono runtime) The advantage of using Xamarin on mobile platforms is that you can use the Xamarin Essentials library to interact with mobile platform APIs easily from.NET. Mono is a free and open-source project to create an Ecma standard-compliant.NET Framework-compatible software framework, including a C# compiler and a Common Language Runtime.Originally by Ximian, it was later acquired by Novell, and is now being led by Xamarin, a subsidiary of Microsoft and the.NET Foundation.The stated purpose of Mono is not only to be able to run Microsoft.NET.
-->In this article, you'll learn how to install .NET Core on macOS. .NET Core is made up of the runtime and the SDK. The runtime is used to run a .NET Core app and may or may not be included with the app. The SDK is used to create .NET Core apps and libraries. The .NET Core runtime is always installed with the SDK.
The latest version of .NET Core is 3.1.
Supported releases
The following table is a list of currently supported .NET Core releases and the versions of macOS they're supported on. These versions remain supported either the version of .NET Core reaches end-of-support.
- A ✔️ indicates that the version of .NET Core is still supported.
- A ❌ indicates that the version of .NET Core isn't supported.
Operating System | .NET Core 2.1 | .NET Core 3.1 | .NET 5 Preview |
---|---|---|---|
macOS 10.15 'Catalina' | ✔️ 2.1 (Release notes) | ✔️ 3.1 (Release notes) | ✔️ 5.0 Preview (Release notes) |
macOS 10.14 'Mojave' | ✔️ 2.1 (Release notes) | ✔️ 3.1 (Release notes) | ✔️ 5.0 Preview (Release notes) |
macOS 10.13 'High Sierra' | ✔️ 2.1 (Release notes) | ✔️ 3.1 (Release notes) | ✔️ 5.0 Preview (Release notes) |
macOS 10.12 'Sierra' | ✔️ 2.1 (Release notes) | ❌ 3.1 (Release notes) | ❌ 5.0 Preview (Release notes) |
Unsupported releases
The following versions of .NET Core are ❌ no longer supported. The downloads for these still remain published:
- 3.0 (Release notes)
- 2.2 (Release notes)
- 2.0 (Release notes)
Runtime information
The runtime is used to run apps created with .NET Core. When an app author publishes an app, they can include the runtime with their app. If they don't include the runtime, it's up to the user to install the runtime.
There are three different runtimes you can install on macOS:
ASP.NET Core runtime
Runs ASP.NET Core apps. Includes the .NET Core runtime.
.NET Core runtime
This runtime is the simplest runtime and doesn't include any other runtime. It's highly recommended that you install ASP.NET Core runtime for the best compatibility with .NET Core apps.
SDK information
The SDK is used to build and publish .NET Core apps and libraries. Installing the SDK includes both runtimes: ASP.NET Core and .NET Core.
Dependencies
.NET Core is supported on the following macOS releases:
.NET Core Version | macOS | Architectures | |
---|---|---|---|
3.1 | High Sierra (10.13+) | x64 | More information |
3.0 | High Sierra (10.13+) | x64 | More information |
2.2 | Sierra (10.12+) | x64 | More information |
2.1 | Sierra (10.12+) | x64 | More information |
Beginning with macOS Catalina (version 10.15), all software built after June 1, 2019 that is distributed with Developer ID, must be notarized. This requirement applies to the .NET Core runtime, .NET Core SDK, and software created with .NET Core.
The installers for .NET Core (both runtime and SDK) versions 3.1, 3.0, and 2.1, have been notarized since February 18, 2020. Prior released versions aren't notarized. If you run a non-notarized app, you'll see an error similar to the following image:
For more information about how enforced-notarization affects .NET Core (and your .NET Core apps), see Working with macOS Catalina Notarization.
libgdiplus
.NET Core applications that use the System.Drawing.Common assembly require libgdiplus to be installed.
An easy way to obtain libgdiplus is by using the Homebrew ('brew') package manager for macOS. After installing brew, install libgdiplus by executing the following commands at a Terminal (command) prompt:
Mono Download Mac
Install with an installer
macOS has standalone installers that can be used to install the .NET Core 3.1 SDK:
Download and manually install
As an alternative to the macOS installers for .NET Core, you can download and manually install the SDK and runtime. Manual install is usually performed as part of continuous integration testing. For a developer or user, it's generally better to use an installer.
If you install .NET Core SDK, you don't need to install the corresponding runtime. First, download a binary release for either the SDK or the runtime from one of the following sites:
- ✔️ .NET 5.0 preview downloads
- ✔️ .NET Core 3.1 downloads
- ✔️ .NET Core 2.1 downloads
Next, extract the downloaded file and use the export
command to set variables used by .NET Core and then ensure .NET Core is in PATH.
To extract the runtime and make the .NET Core CLI commands available at the terminal, first download a .NET Core binary release. Then, open a terminal and run the following commands from the directory where the file was saved. The archive file name may be different depending on what you downloaded.
Use the following command to extract the runtime:
Use the following command to extract the SDK:
Tip
The preceding export
commands only make the .NET Core CLI commands available for the terminal session in which it was run.
You can edit your shell profile to permanently add the commands. There are a number of different shells available for Linux and each has a different profile. For example:
- Bash Shell: ~/.bash_profile, ~/.bashrc
- Korn Shell: ~/.kshrc or .profile
- Z Shell: ~/.zshrc or .zprofile
Edit the appropriate source file for your shell and add :$HOME/dotnet
to the end of the existing PATH
statement. If no PATH
statement is included, add a new line with export PATH=$PATH:$HOME/dotnet
.
Also, add export DOTNET_ROOT=$HOME/dotnet
to the end of the file.
This approach lets you install different versions into separate locations and choose explicitly which one to use by which application.
Install with Visual Studio for Mac
Visual Studio for Mac installs the .NET Core SDK when the .NET Core workload is selected. To get started with .NET Core development on macOS, see Install Visual Studio 2019 for Mac. For the latest release, .NET Core 3.1, you must use the Visual Studio for Mac 8.4.
The last time it was used it was just shut down 4 days ago and yesterday CS3 would not start. Adobe cs3 for mac keygen.
Install alongside Visual Studio Code
Visual Studio Code is a powerful and lightweight source code editor that runs on your desktop. Visual Studio Code is available for Windows, macOS, and Linux.
While Visual Studio Code doesn't come with an automated .NET Core installer like Visual Studio does, adding .NET Core support is simple.
- Download and install Visual Studio Code.
- Download and install the .NET Core SDK.
- Install the C# extension from the Visual Studio Code marketplace.
Install with bash automation
The dotnet-install scripts are used for automation and non-admin installs of the runtime. You can download the script from the dotnet-install script reference page.
The script defaults to installing the latest long term support (LTS) version, which is .NET Core 3.1. You can choose a specific release by specifying the current
switch. Include the runtime
switch to install a runtime. Otherwise, the script installs the SDK.
Note
The command above installs the ASP.NET Core runtime for maximum compatability. The ASP.NET Core runtime also includes the standard .NET Core runtime.
Docker
Containers provide a lightweight way to isolate your application from the rest of the host system. Containers on the same machine share just the kernel and use resources given to your application.
.NET Core can run in a Docker container. Official .NET Core Docker images are published to the Microsoft Container Registry (MCR) and are discoverable at the Microsoft .NET Core Docker Hub repository. Each repository contains images for different combinations of the .NET (SDK or Runtime) and OS that you can use.
Microsoft provides images that are tailored for specific scenarios. For example, the ASP.NET Core repository provides images that are built for running ASP.NET Core apps in production.
For more information about using .NET Core in a Docker container, see Introduction to .NET and Docker and Samples.
Next steps
- How to check if .NET Core is already installed.
- Working with macOS Catalina notarization.
- Tutorial: Get started on macOS.
- Tutorial: Create a new app with Visual Studio Code.
- Tutorial: Containerize a .NET Core app.
The Mono runtime implements the ECMA Common Language Infrastructure (CLI). The Mono runtime implements this virtual machine.
If you are interested in the technical aspects of the Mono runtime check the Runtime Documentation.
The runtime offers the following services:
- Code Execution
- Code loading
- Support for dynamically generating code
- Garbage Collection, using one of:
- Conservative Boehm Garbage Collector
- Code Generation
- Just-in-Time compilation, partial and full Ahead-of-Time modes
- Backend engines:
- Mono’s own engine
- Exception Handling
- Software-triggered exceptions
- Hardware-triggered exceptions like Floating point exceptions, null reference exceptions
- Operating system interface
- File system IO
- Networking IO
- Access to operating system properties and features
- On Unix systems, Mono.Posix APIs
- Program isolation using Application Domains (AppDomain)
- Thread management:
- Threadpool for user code
- Threadpool for networked IO
- Asynchronous method invocation
- Console access
- Security System
The Mono runtime can be used as a stand-alone process, or it can be embedded into applications
Embedding the Mono runtime allows applications to be extended in C# while reusing all of the existing C and C++ code. For more details, see the Embedding Mono page and the Scripting With Mono page.
Supported Platforms
Mono has support for both 32 and 64 bit systems on a number of architectures as well as a number of operating systems.
Supported Operating Systems
Operating Systems Powerpoint word for mac.
- Apple iOS, iOS
- Apple macOS,
- BSD - OpenBSD, FreeBSD, NetBSD
Supported Architectures
Supported Architectures | Operating system |
---|---|
s390, s390x (32 and 64 bits) | Linux |
SPARC (32) | Solaris, Linux |
PowerPC | Linux, macOS, Wii, PlayStation 3 |
x86 | Linux, FreeBSD, OpenBSD, NetBSD, Microsoft Windows, Solaris, macOS, Android |
x86-64: AMD64 and EM64T (64 bit) | Linux, FreeBSD, OpenBSD, Solaris, macOS |
IA64 Itanium2 (64 bit) | Linux |
ARM: little and big endian | Linux (both old and new ABI), iPhone, Android |
Alpha | not maintained. Linux |
MIPS | Linux |
HPPA | not maintained Linux |
Note that the Alpha, MIPS, ARM big-endian and HPPA architectures are community-supported and may not be as complete as the other architectures.
Support for SPARC64 works in older versions of Mono, but not in the recent versions.
Packages for most platforms are available from the Downloads page.
Embedded systems
To make mono more suitable for some architectures used as embedded systems have a look at the Small footprint page.
Compilation Engine
Paolo Molaro did a presentation on the current JIT engine and the new JIT engine. You can find his slides here.
We have re-written our JIT compiler. We wanted to support a number of features that were missing: Ahead of Time compilation, simplify porting and have a solid foundation for compiler optimizations.
Ahead-of-time compilation
The idea is to allow developers to pre-compile their code to native code to reduce startup time, and the working set that is used at runtime in the just-in-time compiler.
Although in Mono this has not been a visible problem, we wanted to pro-actively address this problem.
When an assembly (a Mono/.NET executable) is installed in the system, then it is possible to pre-compile the code, and have the JIT compiler tune the generated code to the particular CPU on which the software is installed.
This is done in the Microsoft.NET world with a tool called ngen.exe.
The code produced by Mono’s ahead-of-time compiler is Position Independent Code (PIC) which tends to be a bit slower than regular JITed code, but what you loose in performance with PIC you gain by being able to use all the available optimizations.
To compile your assemblies with this, just run this command:
The above command will turn on all optimizations (-O=all
) and then instructs Mono to compile the code to native code.
Additionally, if you want to do full static builds (and be able to run without the JIT engine), you can use:
Then you can configure your Mono runtime with –enable-minimal to remove the JIT engine. This is useful on systems that do not support Just-in-Time compilation at the kernel level.
Some features like Reflection.Emit and other forms of dynamic code generation are not support in this scenario.
Notice that for Mono 2.0 generics are not supported when doing full-AOT.
Some optimizations are being planned: OptimizingAOT
Bundles
Mono also offers bundles. Bundles merge your application, the libraries it uses and the Mono runtime into a single executable image. You can think of bundles as “statically linking mono” into your application.
To do this, you use the “mkbundle” command (see the man page distributed with Mono for more details).
For example, to create a fully static and bundled version of Mono for “hello world”, you would:
Of course, you can also just embed the libraries, without the actual Mono runtime, by removing the –static flag.
Linker
Mono ships with a customizable assembly-linker. This is a technology that can be used tocreate a custom deployment of the Mono runtime that only contains the code that your applicationuses. This is similar to what a native linker does, except that we retain the same assemblies.
For example:
You can combine the output of the linker with the bundler. Allowing you to producesmaller versions of your self-contained executables.
Platform for Code Optimizations
Beyond the use of the Mono VM as Just-in-Time compiler, we need to make Mono code generation as efficient as possible.
The design called for a good architecture that would enable various levels of optimizations: some optimizations are better performed on high-level intermediate representations, some on medium-level and some at low-level representations.
Also it should be possible to conditionally turn these on or off. Some optimizations are too expensive to be used in just-in-time compilation scenarios, but these expensive optimizations can be turned on for ahead-of-time compilations or when using profile-guided optimizations on a subset of the executed methods.
Simplify Porting
We wanted to reduce the effort required to port the Mono code generator to new architectures.
For Mono to gain wide adoption in the UNIX world, it is necessary that the JIT engine works in most of today’s commercial hardware platforms.
The new Mono engine now supports both 32 and 64 bit systems and various architectures (See Supported Platforms).
Profiling and Code Coverage
Mono provides a number of profiling tools and code coverage tools.
See the Performance Tips page for details on using the profiler, and the Code Coverage page for information on how to use the code coverage functionality with your application and your test suites.
DTrace
Mono’s support for DTrace is available on Solaris and macOS.
Logging runtime events
See Logging runtime events.
Versioning
Mono supports a Global Assembly Cache or GAC. The GAC is used to share libraries between different applications, to keep multiple versions of the same library installed at once and to avoid conflicts over the names of the libraries and they also play an important role in trust and security.
See the Assemblies_and_the_GAC document for more details.
Garbage Collection
Mono today uses Boehm’s GC as its Garbage Collection engine. We are also working on a precise and compacting GC engine specific to Mono.
The GC interface is being isolated to allow for more than one GC engine to be used or for the GC to be tuned for specific tasks.
Mono’s use of Boehm GC
We are using the Boehm conservative GC in precise mode.
There are a few areas that the GC scans for pointers to managed objects:
- The heap (where other managed objects are allocated)
- thread stacks and registers
- static data area
- data structures allocated by the runtime
(1) is currently handled in mostly precise mode: almost always the GC will only consider memory words that contain only references to the heap, so there is very little chance of pointer misidentification and hence memory retention as a result. The new GC requires a fully precise mode here, so it will improve things marginally. The details about mostly precise have to do with large objects with sparse bitmaps of references and the handling of multiple appdomains safely.
(2) is always scanned conservatively. This will be true for the new GC, too, at least for the first versions, where I’ll have my own share of fun at tracking the bugs that a moving generational GC will expose. Later we’ll conservatively scan only the unmanaged part of the stacks.
(3) We already optimized this both with Boehm and the current GC to work in precise mode.
(4) I already optimized this to work in mostly precise mode (ie some data structures are dealt with precisely, others not yet). I’ll need to do more work in this area, especially for the new GC, where having pinned objects can be a significant source of pain.
References
Garbage collection list and FAQ: http://www.iecc.com/gclist/
“A Generational Mostly-concurrent Garbage Collector”:
Details on The Microsoft .NET Garbage Collection Implementation:
IO and threading
The ECMA runtime and the .NET runtime assume an IO model and a threading model that is very similar to the Win32 API.
Dick Porter has developed WAPI: the Mono abstraction layer that allows our runtime to execute code that depend on this behaviour, this is called the `io-layer’ in the Mono source code distribution.
This io-layer offers services like named mutexes that can be shared across multiple processes.
To achieve this, the io-layer uses a shared file mapping across multiple Mono processes to track the state that must be shared across Mono applications in the ~/.wapi directory.
Useful links
See our Papers section for various articles describing virtual machines and JIT compilers.
Porting
See the Porting page for more details on porting Mono to a new platform.
Mono Runtime For Mac Catalina
Projects Under Development
There are a number of projects being developed in branches or on separate trees for the runtime, these are:
- Runtime Projects: General Runtime Projects.
- Runtime Requests: Ideas of things that we could use to improve Mono’s runtime.
- Compacting GC: A generational, compacting GC for Mono.
- JIT Regalloc: A new register allocation framework.
- Mono_Runtime_API_Changes: Changes that will be introduced in Mono 2.8.
Completed projects:
- Continuations: Support for co-routines and continuations in Mono.
- SafeHandles: Support for 2.0 SafeHandles.
- Linear: An update to the JIT’s internal representation (IR).
COM and XPCOM
Mono Runtime Terminal
Mono’s COM support can be used to interop with system COM components in Windows and in Linux (if you use a COM implementation). Additionally, Mono’s COM support can be used to access software based on Mozilla’s XPCOM.
Mono Runtime For Mac High Sierra
For details on the progress, see the COM Interop page.