MacOS – sudo and some other system commands not working with platypus

bashcommand linemacos

I am making a shell script that works great on its own, but does not work correctly when packaged with Platypus. It does not want to execute sudo, and a few other system commands. Are there any work arounds to this?

Note: This is when you select the "Run with Administrator privileges" option. Also, this is an answer-it-yourself question, since I would imagine someone else out there would have this issue as well.

Best Answer

You can also use the osascript to launch the application. This ensures sudo access.

osascript -e "do shell script \"/path2/ $*\" with administrator privileges"

You can put this in another shell script to call your script. Or directly run your required command within the quotes.

This is better since you don't have to rely on /usr/bin/sudo being run recently or not