Fixing the HTTPS Developer Certificate Error in .NET on macOS Sequoia

michaelcharles

Michael Charles Aubrey

Posted on September 24, 2024

Fixing the HTTPS Developer Certificate Error in .NET on macOS Sequoia

MacOS 15 Sequoia has introduced changes to its security APIs which has broken the dotnet CLI's ability to generate and trust HTTPS developer certificates.

The command dotnet dev-certs https fails with the message:

There was an error creating the HTTPS developer certificate.
Enter fullscreen mode Exit fullscreen mode

When run with the verbose flag (-v), you'll see a more detailed error:

An error has occurred generating the certificate: Interop+AppleCrypto+AppleCommonCryptoCryptographicException: The specified item is no longer valid. It may have been deleted from the keychain.
Enter fullscreen mode Exit fullscreen mode

Impact

This issue is blocking .NET developers on macOS Sequoia from generating or trusting HTTPS development certificates. Without these certificates, you can't develop and debug .NET applications that require HTTPS.

Workaround

While a fix is planned for release in October, here's a workaround (thanks to users pvasek and kalebzettl on GitHub) that you can use right now:

  1. Just in case, delete any certs that currently exist. Open a terminal and run: dotnet dev-certs https --clean

  2. Download the tar.gz file of the "main" release from the .NET SDK package table. You can also access the links directly below.

  3. Unpack the downloaded file.

  4. Remove the quarantine attribute from the unpacked folder. From your terminal run: xattr -d com.apple.quarantine -r <folderName> Replace <folderName> with the name of your unpacked folder. For example: xattr -d com.apple.quarantine -r dotnet-sdk-9.0.100-rc.2.24473.22-osx-arm64

  5. Navigate to the unpacked folder: cd dotnet-sdk-9.0.100-rc.2.24473.22-osx-arm64

  6. From within this folder, run the following to generate and trust the certificate. ./dotnet dev-certs https --trust

Note the ./ before dotnet – this ensures you're using the version you just downloaded, not the globally installed one.

This should successfully generate and trust the HTTPS developer certificate, allowing you to continue your .NET development on macOS Sequoia.

💖 💪 🙅 🚩
michaelcharles
Michael Charles Aubrey

Posted on September 24, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related