We ran into a problem when trying to install Homebrew on macOS using a Custom Action in our install4j installer. Before executing the Homebrew installation script, we request admin privileges as shown in the logs below (the user that runs the installer is an Administrator). However, the installation script does not seem to be executed as an admin, it fails with the error message Need sudo access on macOS (e.g. the user xxx needs to be an Administrator)!
.
Our Custom Action has the elevation type "Elevate to maximum available privileges", shouldn't this lead to the action using admin privileges?
[INFO] com.install4j.runtime.beans.actions.misc.RequestPrivilegesAction [ID 22]: Execute action
Property linuxPrivilegeRequirement: None
Property allRequested: true
Property failIfNotObtainedLinux: false
Property failIfNotObtainedMac: true
Property failIfNotObtainedWin: true
Property failIfNotRootUnix: true
Property obtainIfAdminMac: true
Property obtainIfAdminWin: true
Property obtainIfNormalMac: true
Property obtainIfNormalWin: true
Property rollbackSupported: false
Property updateInstallationDirectory: true
args: ...
Execute action successful after 7597 ms
[INFO] com.example.HomebrewInstaller [ID 161]: Using communication backend com.install4j.runtime.installer.platform.unix.PipeCommunicationBackend
Execute action
Property context: null
Property rollbackSupported: false
Executing commands: [/bin/zsh, -c, NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"]
Output: ==> Running in non-interactive mode because `$NONINTERACTIVE` is set.==> Checking for `sudo` access (which may request your password)...Need sudo access on macOS (e.g. the user xxx needs to be an Administrator)!
Execute action successful after 312 ms