How to Install .NET Core on Linux and macOS

June 6, 2019

If you want to use Retro Assembler to code on Linux (even on a Raspberry Pi) or on macOS, you have to install .NET Core on your computer. Normally you'd just go to https://dotnet.microsoft.com/download and follow the instructions, but if you need help, I'll try to provide some here.

Disclaimers

Installing on macOS

Installing on Linux

Here are the commands you'll need to enter into the Terminal:

#Download the Ubuntu 19.04 related packages for the package manager.
#(Obviously this command is one single line, edit it together)
wget -q https://packages.microsoft.com/config/ubuntu/
        19.04/packages-microsoft-prod.deb

#Install it for the package manager.
sudo dpkg -i packages-microsoft-prod.deb

#Install this utility.
sudo apt-get install apt-transport-https

#Update the package manager.
sudo apt-get update

#Install the .NET Core Runtime.
sudo apt-get install dotnet-runtime-2.2

Installing on Raspberry Pi and on other ARM based SBCs

Here are the commands you'll need to enter into the Terminal:

#Install some possibly missing packages that will be needed.
sudo apt-get install libunwind8 gettext curl wget

#Make the dotnet directory where the .NET Core Runtime will be installed.
sudo mkdir /opt/dotnet

#Extract the files from the downloaded file.
sudo tar -xvf dotnet.tar.gz -C /opt/dotnet/

#Set up a symbolic link to this directory so it will be found on path
#when you type in the command "dotnet".
sudo ln -s /opt/dotnet/dotnet /usr/local/bin

This works perfectly, the only caveat is that you'll need to perform this manual install with every updated .NET Core version you want to use.

Testing in the Terminal

Run this command to check whether the .NET Core Runtime has been installed successfully. It will list the currently installed version's details.

dotnet --info

And now you can run Retro Assembler from the Portable directory, with this command:

dotnet retroassembler.dll

Optional, but it is recommended to edit the command shell's startup file with a command alias to run Retro Assembler with ease, as if it was a Linux/Mac native command line application.

Open your user's home directory and edit the hidden file .bashrc on Linux, or .bash_profile on macOS. The latter usually doesn't exist and you have to create it. Then enter this line into the bash file:

alias ra='dotnet ~/Documents/retroassembler/Portable/retroassembler.dll'

This will allow you to just enter the command ra and run the assembler from either the Terminal or from Visual Studio Code.

(Assuming that you extracted the downloaded Retro Assembler zip file into your Documents folder as retroassembler. Otherwise use the file path you set up for the Portable directory.)