question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

M1 Mac cannot find libhostfxr.dylib

See original GitHub issue

Describe the bug

I’m trying to port an app from .NET 5 to .NET 6 to support M1 Macs. I could build and publish the project fine, but when I start the app, I get the following error -

Failed to load 
 azuredatastudio/extensions/mssql/sqltoolsservice/OSX/3.0.0-release.129/libhostfxr.dylib, error: dlopen(azuredatastudio/extensions/mssql/sqltoolsservice/OSX/3.0.0-release.129/libhostfxr.dylib, 1): no suitable image found.  Did find:
 azuredatastudio/extensions/mssql/sqltoolsservice/OSX/3.0.0-release.129/libhostfxr.dylib: mach-o, but wrong architecture
 azuredatastudio/extensions/mssql/sqltoolsservice/OSX/3.0.0-release.129/libhostfxr.dylib: mach-o, but wrong architecture
The library libhostfxr.dylib was found, but loading it from 
 azuredatastudio/extensions/mssql/sqltoolsservice/OSX/3.0.0-release.129/libhostfxr.dylib failed
  - Installing .NET prerequisites might help resolve this problem.
     https://go.microsoft.com/fwlink/?linkid=2063366

I saw other similar issues, where this issue occurs when loading .NET 5 and 6 side by side, but I only have .NET 6 on this M1 machine.

To Reproduce

Exceptions (if any)

Further technical details

  • Include the output of dotnet --info
 .NET SDK (reflecting any global.json):
 Version:   6.0.100-rc.1.21458.32
 Commit:    d7c22323c4

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  11.6
 OS Platform: Darwin
 RID:         osx.11.0-arm64
 Base Path:   /usr/local/share/dotnet/sdk/6.0.100-rc.1.21458.32/

Host (useful for support):
  Version: 6.0.0-rc.1.21451.13
  Commit:  d7619cd4b1

.NET SDKs installed:
  6.0.100-rc.1.21458.32 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0-rc.1.21452.15 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0-rc.1.21451.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
  • The IDE (VS / VS Code/ VS4Mac) you’re running on, and its version - VS Code for Mac (ARM64) - Big Sur 11.6
  • Result of running dotnet --list-sdks - 6.0.100-rc.1.21458.32 [/usr/local/share/dotnet/sdk]

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

8reactions
mrlifecommented, Feb 25, 2022

Awesome, this works. Would this be the official way or do you think the tool installer will be updated to detect the architecture?

dotnet tool install dotnet-ef --global -a arm64
1reaction
marcpopMSFTcommented, Oct 5, 2021

I recommend trying this again once RC2 is available as we’ve made significant changes to our Mac installer behavior. CC @vitek-karas @ericstj to see if they agree that our rc2 changes will fix this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSC Mac M1 Install - "required library libhostfxr.dylib could ...
Both VSC and the current preview version of Power Platform support M1. If you are on newer versions of macOS, Apple may have...
Read more >
Problem installing with dotnet on M1 MacOS architecture
The library libhostfxr.dylib was found, but loading it from /usr/local/share/dotnet/host/fxr/6.0.3/libhostfxr.dylib failed - Installing .
Read more >
.NET 6 and M1 problems when other SDKs are present in ...
Run Rider, go to File | Settings | Build, Execution, Deployment | Toolset and Build and choose proper dotnet CLI (x64 or ARM...
Read more >
.net 6 SDK on M1 MacBook Pro fails to load after installing ...
The library libhostfxr.dylib was found, but loading it from /usr/local/share/dotnet/host/fxr/6.0.0/libhostfxr.dylib failed. Installing .
Read more >
Running Entity Framework Core on M1 : r/dotnet
I just got the new MacBook Pro, and have everything working, except when I try running the dotnet ef dbcontext scaffold command on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found