[go: up one dir, main page]

DEV Community

Tepol
Tepol

Posted on

NET SDK

Hey! Hope you're doing well.

So, I finally got around to setting up the .NET SDK on my Mac—you know, the official toolchain for building .NET apps cross-platform. I've been wanting to play with ASP.NET Core for a backend project, and the promise of writing C# on macOS sounded great.

Install was smooth—downloaded the installer from the official site, ran it, everything seemed fine. Opened Terminal, typed dotnet --version to verify… and got zsh: command not found. The SDK was installed, but the dotnet command wasn't in my PATH.

The Wrong Turn I Took First

My first thought: "Maybe the installer didn't add it to PATH." I checked /usr/local/share/dotnet/—the dotnet binary was there. So I manually added export PATH=$PATH:/usr/local/share/dotnet to my .zshrc, sourced it, and dotnet --version worked. Great, problem solved… or so I thought.

Then I tried creating a new project with dotnet new console. It created the project, but when I ran dotnet run, I got a cryptic error about being unable to load shared library. Something about permissions.

The "Aha!" Moment

I spent an hour chasing that error, reinstalling, checking dependencies. Then I realized: even though dotnet was in my PATH, the runtime needed to write temporary files and access certificates, and macOS was blocking it. The fix was two-fold:

  1. Grant terminal app access in System Settings > Privacy & Security > Files and Folders. I enabled access for my terminal (iTerm2) to "Documents" and "Downloads"—that resolved the temp file issues.

  2. Install the .NET certificates for HTTPS development. The SDK includes a tool for this: run dotnet dev-certs https --trust and enter your password when prompted. This adds the development certificate to your keychain.

After those two steps, dotnet run worked perfectly—"Hello, World!" printed instantly.

I found this page with the system requirements that mentioned the certificate step in the user comments: the resource I used. Super helpful for getting unstuck.

Quick Checklist

If .NET SDK isn't working smoothly on macOS:

  1. Ensure dotnet is in PATH (usually /usr/local/share/dotnet)
  2. Grant terminal app file access in System Settings > Privacy & Security
  3. Trust HTTPS certificates: dotnet dev-certs https --trust
  4. Test with dotnet new console && dotnet run

Apple's file permissions guide explains the security context. The official .NET docs have detailed setup instructions.

Anyway, my ASP.NET backend is now running locally. Let me know if you try it!

Talk soon

Top comments (0)