Skip to content

C# omnisharp - fails to find dotnet runtime installed via brew #10882

Closed as not planned
@spaceunifyfifty

Description

@spaceunifyfifty

I have installed the c# extension and open my Monogame project in Zed. I get syntax highlighting, but no IDE hints or linting. I open zed logs and see

[INFO] starting language server "omnisharp", path: "/Users/john/MyGame", id: 5
[INFO] starting language server. binary path: "/Users/john/Library/Application Support/Zed/extensions/work/csharp/omnisharp-v1.39.11/OmniSharp", working directory: "/Users/john/MyGame", args: ["-lsp"]
[ERROR] crates/lsp/src/lsp.rs:344: cannot read LSP message headers
[ERROR] crates/lsp/src/lsp.rs:366: Broken pipe (os error 32)
[ERROR] failed to start language server "omnisharp": oneshot canceled
[ERROR] server stderr: Some("A fatal error occurred. The required library libhostfxr.dylib could not be found.\nIf
this is a self-contained application, that library should exist in [/Users/john/Library/Application Support/Zed/extensions/work/csharp/omnisharp-v1.39.11/].\nIf
this is a framework-dependent application, install the runtime in the global location [/usr/local/share/dotnet/x64]
or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].\n")

I know that I have already installed dotnet / dotnet-sdk prior, using homebrew. The output of which dotnet is /opt/homebrew/bin/dotnet.
I tried running set DOTNET_ROOT $(dirname $(realpath $(which dotnet))) before launching Zed from the cli as another post suggested (the output of echo $DOTNET_ROOT is /usr/local/share/dotnet afterwards), but no success.

How can I make Zed use my brew installed dotnet runtime?

Environment

Zed: v0.131.6 (Zed)
OS: macOS 14.2.1
Memory: 8 GiB
Architecture: aarch64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug[core label]c#C# programming language supportlanguageAn umbrella label for all programming languages syntax behaviorslanguage serverAn umbrella label for all language serversstaleLabel used by `stale` actiontoolingAn umbrella label for language tools, linters, formatters, etc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions