Wei Weng
Wei Weng

Reputation: 51

dotnet restore unable to load shared library 'libproc' or one of its dependencies on Mac OS

I am following the tutorial for .NET on

https://www.microsoft.com/net/learn/get-started/macos

I installed the .NET SDK and create an app by using on macOS High Sierra Version 10.13.5:

~$ dotnet new console -o myApp

which gives me an error of:

The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on myApp/myApp.csproj...
Unable to load shared library 'libproc' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES 
environment variable: dlopen(liblibproc, 1): image not found

I tried to do

export DYLD_PRINT_LIBRARIES=/usr/lib/

before deleting the created folder and files, and I get a lot of printed statements that look like:

dyld: loaded: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.1.1/System.IO.Compression.Native.dylib

as well as the same error:

The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on myApp/myApp.csproj...
Unable to load shared library 'libproc' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES 
environment variable: dlopen(liblibproc, 1): image not found

Upvotes: 3

Views: 2740

Answers (2)

craig
craig

Reputation: 26262

I noticed that my comment only worked when I started pwsh in ~.

I created a symlink in /usr/local/microsoft/powershell/6 that points to libproc.dylib:

/usr/local/microsoft/powershell/6$ sudo ln -s /usr/lib/libproc.dylib libproc.dylib

PowerShell starts correctly in any directory.

This will likely need to be recreated when I upgrade PowerShell Core (via Homebrew Cask).

** edit **

I should have read the question more closely--it was about dotnet, not pwsh.

Upvotes: 1

Wei Weng
Wei Weng

Reputation: 51

I got it to work by using fs-usage to examine where does dotnet try to find libproc.dylib. In my case, I found that dotnet was trying to find libproc.dylib at ~/libproc.dylib, so I copied /usr/lib/libproc.dylib to ~/libproc.dylib and dotnet worked.

I think this is not a satisfactory answer so if anyone knows why dotnet was not looking for libproc.dylib at /usr/lib/libproc.dylib, please help me out. Thank you!

Upvotes: 2

Related Questions