wood burning stoves
The moose likes Mac OS and the fly likes gksudo in MacOS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Mac OS
Bookmark "gksudo in MacOS" Watch "gksudo in MacOS" New topic

gksudo in MacOS

jaibhim max

Joined: Nov 15, 2010
Posts: 21
Hi All,

I am searching for "gksudo" 's replacement in Mac.... I am developing a application that requires sudo pesmissions. I would like to display a pop-up to ask for sudo password. I have googled it and got to know about "cocoasudo". But cocoasudo needs to be installed.
Is there any inbuilt utility in Mac to achieve this.

James Sabre
Ranch Hand

Joined: Sep 07, 2004
Posts: 781

My knowledge of OS-X is fairly limited but assuming it is not too dissimilar to Linux then a 'man sudo' should reveal that there is an an environment variable SUDO_ASKPASS which can be set to define a program to run to ask for the password when sudo -A is used. It may be that a different environment variable is used on OS-X but looking at the man page should help.

On Linux I have a Java Swing program that I can use but there are definite limitations. The main limitation I have found is that the password program cannot have any command line arguments so
is not allowed and one must wrap the 'java -jar mysudo.jar' up in a script. If I find a way to avoid this limitation I will post it but don't hold your breath; I don't think it is possible (security restrictions?).

Retired horse trader.
 Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
marc weber

Joined: Aug 31, 2004
Posts: 11343

I don't know, but might this help...?

Apple Developer - Mac Authorization Services

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
jaibhim max

Joined: Nov 15, 2010
Posts: 21
Thanks a lot.
Adam Koblentz

Joined: Mar 18, 2011
Posts: 19

Also from the CLI, you can run "sudo open <insert app.app>"
I agree. Here's the link: http://aspose.com/file-tools
subject: gksudo in MacOS
It's not a secret anymore!