Mastodon hachyterm.io

I want to get into C# development, because my future project will likely be in C#.

I wanted to use Rider, a JetBrains product. I am using IntelliJ (the flagship JetBrains IDE) at my day job, and I find it more powerful than VS Code.
I had a bit of difficulties to get Rider working on macOs.

My alternative editor right now is Helix, a terminal editor.

There were also some small hiccups with setting up a language server support for Helix.

So here’s how I solved my problems with C# on macOs.

Install Dot.Net & Mono

I normally use homebrew to install my dependencies. Unfortunately, this doesn’t seem to play well with Rider.

So, instead, I manually downloaded the official installers for both Dot.net and Mono.

Don’t forget to add Mono to your $PATH:

export PATH=$PATH:/Library/Frameworks/Mono.framework/Versions/Current/bin/

If you know how to get Rider working with homebrew, please let me know.

Rider

Follow this guide to set your toolchain.

Rider seems to have problems finding the installation folder, so head over the Rider settings under “Build, Execution, Deployment > Toolset and Build”.

You can find out your installation directory by running the following commands in your terminal:

which dotnet

&

which mono

Helix

The documentation has a guide on how to add OmniSharp as the language server fo C#.

But first we need to install OmniSharp.

Find the newest release on the official website.

I install my user packages into ~/.local/bin:

# download & extract archive
curl -sSL https://github.com/OmniSharp/omnisharp-roslyn/releases/download/v1.39.8/omnisharp-linux-arm64.tar.gz | tar xvzf - -C ~/.local/bin/
# make sure that we have the correct permissions
chmod 744 ~/.local/bin/omnisharp/*

Now, add the language server in ~/.config/helix/languages.toml:

[[language]]
name = "c-sharp"
language-server = { command = "dotnet", args = [ "dotnet", "/Users/me/.local/bin/omnisharp/Omnisharp.dll", "--languageserver" ] }

You need to use the absolute path as Helix can’t yet expand ~ to your home folder.

Recap

The biggest hurdle was the Rider setup as I’ve been sifting through the support forum for JetBrains to find out why Rider doesn’t find mono or dotnet.
There were some issues for Linux users, but nothing about homebrew.
I think the underlying issue is that Rider just doesn’t work well without any folders that are not “standard”.
And it seems not to recognize the packages installed via homebrew into /opt/homebrew/bin.