I am automating an installation of an .pkg file in Mac OS X using Java and to do it I have this command for bash console:
echo 'Control123' | sudo -S installer -pkg /Users/george/Downloads/MyPackage.pkg -target /
I am executing this command from Java Runtime:
Runtime.getRuntime().exec("echo 'Control123' | sudo -S installer -pkg /Users/george/Downloads/MyPackage.pkg -target /");
but the package is not installed, if execute the command in the Bash console. it works normally.