How to let mac open a windows ask for administrator privileges
Hi, I have a new question by package app on mac
After fyne package -icon xxx.png , I get a mac os app,but this app don't have the sudo privileges
my func() in button need sudo privileges
How to let this app open a window ask for sudo privileges when user click a fyne button on mac?
Or when open app ,it ask for privileges like on windows
Then User can enter the sudo's password and give app privileges
Thank you

Fyne does not support privelege escallation. What sort of app needs to run as system administrator?
I have many needs on that , for example, I want my app can exec a command line like " sudo mount disk..." by click a button ,or restart mac , which need sudo privileges . Is there a easy way to achieve that ?
I'd head to the macOS documentation, you can always call out to their APIs with CGo. https://developer.apple.com/library/archive/documentation/Security/Conceptual/SecureCodingGuide/Articles/AccessControl.html
Thank you so much I only use golang but not familiar with C I will study that document , I hope fyne can support that one day
@JackySmith I found a library that can support windows and MAC, which is very useful https://github.com/getlantern/elevate
However, I still hope Fyne native support
I know this issue is not directly related to fyne. However, I found that https://github.com/getlantern/elevate does not work if you are trying to issue a sudo command on MAC. I addition, the repository: https://git.zx2c4.com/wireguard-windows does not have a method to file a bug. Hopefully I will be able to find another solution that actually works.
One potential way to run a sudo command: Use a https://github.com/fyne-io/terminal widget and its term.Write() method to write the sudo command to the terminal (followed by "; exit $?\n"). The user will see the actual command and be able to enter the password (or even just use TouchID for the purpose, if enabled [1]). term.ExitCode() could be used to verify success.
This works for me on macOS and Linux - on Windows I currently right-click the .exe to "Run as Administrator". Sooner or later, sudo might also become an option for that [2], maybe.
[1] https://apple.stackexchange.com/questions/259093/can-touch-id-on-mac-authenticate-sudo-in-terminal [2] https://devblogs.microsoft.com/commandline/introducing-sudo-for-windows/