Skip to content

dotnet-core-uninstall should not require admin permissions in a custom install location #267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tillig opened this issue Sep 28, 2023 · 3 comments

Comments

@tillig
Copy link

tillig commented Sep 28, 2023

I'm running on MacOS (Mac M1, MacOS Ventura) and have all of my .NET SDKs installed in my user folder at ~/.dotnet. I also have the following set in my ~/.profile so builds and things run great.

export DOTNET_INSTALL_DIR="$HOME/.dotnet"
export DOTNET_ROOT="$HOME/.dotnet"
export PATH="$DOTNET_ROOT:$DOTNET_ROOT/tools:$PATH"

I can install the .NET SDK perfectly using the dotnet-install script.

When I run dotnet-core-uninstall list, it correctly sees DOTNET_INSTALL_DIR and lists my SDKs and runtimes.

However, when I try to dotnet-core-uninstall remove it tells me:

The current user does not have adequate privileges. See https://aka.ms/dotnet-core-uninstall-docs.

All I see in the docs is "it requires admin permissions":

The tool requires elevation to uninstall .NET SDKs and runtimes. Run the tool in an Administrator command prompt on Windows and with sudo on macOS. The dry-run and whatif commands don't require elevation.

It doesn't tell me why and doesn't really make a ton of sense in this use case. It appears to just check for admin permissions and fail out of hand, even if it really doesn't need them.

Would it be possible to maybe do one of these things...?

  • Stop requiring admin by default
  • Add a --no-admin or similar switch to allow bypassing that check
  • Only check for admin permissions when it's time to modify something that actually might require admin

Alternatively, is there a document that explains what uninstalling a bundle on MacOS means so I could maybe script it? Is it just a matter of dropping the ~/.dotnet/sdk/XXXX version folder or ~/dotnet/host/fxr/XXXX version folder?

@HaseebAhmed49
Copy link

It works for me

@andherson17
Copy link

A year later I'm seeing this issue on a Mac Mini M1, and found this thread. I'm not familiar with just about anything Apple, and less about entering commands in a terminal.

I installed dotnet-sdk-8.0.402-osx-x64.pkg from here: https://dotnet.microsoft.com/en-us/download/dotnet/8.0 as a requirement for another piece not software, and the dotnet command was not found in terminal. I've set paths in Windows, but have failed to figure out if that's the case in the macOS.

Hoping to uninstall and start over, I downloaded the uninstaller for it here:
https://github.com/dotnet/cli-lab/releases

But after finally figuring out the right commands to set, I'm getting that admin privileges error:
The current user does not have adequate privileges.

I'm not quite sure where else to find support for this. I am listed as an admin in Mac system settings. Has anyone seen a fix or workaround fore this since tillig's post last year?

@TyceHerrman
Copy link

@andherson17 I was able to run simply with sudo. Docs here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants