efcore: Failed to load 6.0.0-preview.3.21201.4/libhostfxr.dylib, no suitable image found. Mac M1

File a bug

Remember:

  • Please check that the documentation does not explain the behavior you are seeing.
  • Please search in both open and closed issues to check that your bug has not already been filed.

Include your code

To fix any bug we must first reproduce it. To make this possible, please attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing.

It is often impossible for us to reproduce a bug when working with only code snippets since we have to guess at the missing code.

Use triple-tick code fences for any posted code.

dotnet ef dbcontext scaffold  "ConnectionString" MySql.Data.EntityFrameworkCore -o Model -f

Include stack traces

Include the full exception message and stack trace for any exception you encounter.

Use triple-tick fences for stack traces.

Failed to load /usr/local/share/dotnet/host/fxr/6.0.0-preview.3.21201.4/libhostfxr.dylib, error: dlopen(/usr/local/share/dotnet/host/fxr/6.0.0-preview.3.21201.4/libhostfxr.dylib, 1): no suitable image found.  Did find:
        /usr/local/share/dotnet/host/fxr/6.0.0-preview.3.21201.4/libhostfxr.dylib: mach-o, but wrong architecture
        /usr/local/share/dotnet/host/fxr/6.0.0-preview.3.21201.4/libhostfxr.dylib: mach-o, but wrong architecture
The library libhostfxr.dylib was found, but loading it from /usr/local/share/dotnet/host/fxr/6.0.0-preview.3.21201.4/libhostfxr.dylib failed
  - Installing .NET prerequisites might help resolve this problem.
     https://go.microsoft.com/fwlink/?linkid=2063366

Include verbose output

Please include --verbose output when filing bugs about the dotnet ef or Package Manager Console tools.

Use triple-tick fences for tool output.

Failed to load /usr/local/share/dotnet/host/fxr/6.0.0-preview.3.21201.4/libhostfxr.dylib, error: dlopen(/usr/local/share/dotnet/host/fxr/6.0.0-preview.3.21201.4/libhostfxr.dylib, 1): no suitable image found.  Did find:
        /usr/local/share/dotnet/host/fxr/6.0.0-preview.3.21201.4/libhostfxr.dylib: mach-o, but wrong architecture
        /usr/local/share/dotnet/host/fxr/6.0.0-preview.3.21201.4/libhostfxr.dylib: mach-o, but wrong architecture
The library libhostfxr.dylib was found, but loading it from /usr/local/share/dotnet/host/fxr/6.0.0-preview.3.21201.4/libhostfxr.dylib failed
  - Installing .NET prerequisites might help resolve this problem.
     https://go.microsoft.com/fwlink/?linkid=2063366

Include provider and version information

EF Core version: 5.0.6 Database provider: MySql.Data.EntityFrameworkCore Target framework: 6.0.100-preview.3.21202.5 Operating system: macOS Big Sur 11.3.1 M1 IDE: console

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 6
  • Comments: 30 (12 by maintainers)

Most upvoted comments

☹️ Sorry friends, I’m still trying to get access to an M1 so I can dig into this.

My mistake, it is not completely fixed, dotnet --version, build, run is working, but the ef scaffold is not

John@Johns-MacBook-Pro XX.Scaffold % dotnet ef dbcontext scaffold  "xxx" Pomelo.EntityFrameworkCore.MySql -o Model --schema xxx -t tablex  -f

Failed to load /usr/local/share/dotnet/host/fxr/6.0.0-preview.6.21352.12/libhostfxr.dylib, error: dlopen(/usr/local/share/dotnet/host/fxr/6.0.0-preview.6.21352.12/libhostfxr.dylib, 1): no suitable image found.  Did find:
        /usr/local/share/dotnet/host/fxr/6.0.0-preview.6.21352.12/libhostfxr.dylib: mach-o, but wrong architecture
        /usr/local/share/dotnet/host/fxr/6.0.0-preview.6.21352.12/libhostfxr.dylib: mach-o, but wrong architecture
The library libhostfxr.dylib was found, but loading it from /usr/local/share/dotnet/host/fxr/6.0.0-preview.6.21352.12/libhostfxr.dylib failed
  - Installing .NET prerequisites might help resolve this problem.
     https://go.microsoft.com/fwlink/?linkid=2063366


John@Johns-MacBook-Pro XX.Scaffold % dotnet ef dbcontext scaffold "xxx" Npgsql.EntityFrameworkCore.PostgreSQL -o xxx -c XXContext -t tablex -f

Failed to load /usr/local/share/dotnet/host/fxr/6.0.0-preview.6.21352.12/libhostfxr.dylib, error: dlopen(/usr/local/share/dotnet/host/fxr/6.0.0-preview.6.21352.12/libhostfxr.dylib, 1): no suitable image found.  Did find:
        /usr/local/share/dotnet/host/fxr/6.0.0-preview.6.21352.12/libhostfxr.dylib: mach-o, but wrong architecture
        /usr/local/share/dotnet/host/fxr/6.0.0-preview.6.21352.12/libhostfxr.dylib: mach-o, but wrong architecture
The library libhostfxr.dylib was found, but loading it from /usr/local/share/dotnet/host/fxr/6.0.0-preview.6.21352.12/libhostfxr.dylib failed
  - Installing .NET prerequisites might help resolve this problem.
     https://go.microsoft.com/fwlink/?linkid=2063366
John@Johns-MacBook-Pro XX.Scaffold % 

The SDK team says this is a known issue. The x64 and arm64 installers stomp over each other and cause problems. Try uninstalling, deleting everything under /usr/local/share/dotnet then try again.

The SDK team says this is a known issue. The x64 and arm64 installers stomp over each other and cause problems. Try uninstalling, deleting everything under /usr/local/share/dotnet then try again.

solved!

Correct me if I’m wrong, but I think the only remaining issue here is just a duplicate of #25927.

@johnseed can you please post the output of dotnet --list-sdks and dotnet tool list -g?

John@Johns-MacBook-Pro ~ % dotnet --list-sdks
3.1.409 [/usr/local/share/dotnet/sdk]
3.1.410 [/usr/local/share/dotnet/sdk]
3.1.411 [/usr/local/share/dotnet/sdk]
5.0.203 [/usr/local/share/dotnet/sdk]
5.0.301 [/usr/local/share/dotnet/sdk]
5.0.302 [/usr/local/share/dotnet/sdk]
6.0.100-preview.6.21355.2 [/usr/local/share/dotnet/sdk]
John@Johns-MacBook-Pro ~ % dotnet tool list -g
Package Id      Version      Commands
-------------------------------------
John@Johns-MacBook-Pro ~ % dotnet tool install --global dotnet-ef
You can invoke the tool using the following command: dotnet-ef
Tool 'dotnet-ef' (version '5.0.8') was successfully installed.
John@Johns-MacBook-Pro ~ % dotnet tool list -g                   
Package Id      Version      Commands 
--------------------------------------
dotnet-ef       5.0.8        dotnet-ef
John@Johns-MacBook-Pro ~ % dotnet ef                  
John@Johns-MacBook-Pro ~ % dotnet ef --help
John@Johns-MacBook-Pro ~ % 

@johnseed Can you try with Npgsql.EntityFrameworkCore.PostgreSQL now that preview 6 is released?

I guess it is fixed in preview6, but the debugger not working with Visual Studio for MAC, that’s another issue.

Unable to attach to CoreCLR. Unknown Error: 0x80131c3c

Update: doing some cleanup (removing old versions) and reinstalling did make it work

dotnet --version
6.0.100-preview.6.21355.2

Don’t really get what happened there.