-
-
Notifications
You must be signed in to change notification settings - Fork 267
Description
On macOS, the install.sh script fails when run with sudo because it attempts to chown the installed mailpit binary to group root, which does not exist on macOS. This causes:
chown: root: illegal group name
ERROR: Setting ownership for "/usr/local/bin/mailpit" binary.
There was an error installing Mailpit.
The script already has logic to set the group to wheel on Darwin, but due to a case mismatch in the OS variable it never takes effect.
Environment
-
OS: macOS (Darwin)
-
Install method:
sudo sh < <(curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh)
Steps to reproduce
-
On macOS, run:
sudo sh < <(curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh)
-
Wait for the script to download and attempt to install
mailpitinto/usr/local/bin. -
Observe the error during the
chownstep.
Actual behavior
Installer fails with:
chown: root: illegal group name
ERROR: Setting ownership for "/usr/local/bin/mailpit" binary.
There was an error installing Mailpit.
The ownership of the installed binary is not set and the script exits with a non‑zero status.
Expected behavior
On macOS, the installer should succeed and set the binary’s owner to root and group to wheel, without error.
Root cause analysis
In install.sh:
-
OSis initially set fromuname -s:case "$(uname -s)" in Linux) OS="linux" ;; Darwin) OS="Darwin" ;; *) echo "OS not supported." exit 2 ;; esac
-
Later, when setting the group for
chown, the script checks:case "$OS" in darwin) GROUP="wheel" ;; *) ;; esac
Because OS is set to Darwin (capital D) but the case pattern is darwin (lowercase d), the darwin) branch never matches. As a result, GROUP remains root, and on macOS chown root:root fails with illegal group name.
Proposed fix
Normalize the OS name for Darwin to darwin so that the later case matches and the group is correctly set to wheel.
Change:
Darwin) OS="Darwin" ;;to:
Darwin) OS="darwin" ;;With this change, the script correctly executes:
OWNER="root"
GROUP="root"
case "$OS" in
darwin) GROUP="wheel" ;;
*) ;;
seac
chown "${OWNER}:${GROUP}" "$INSTALL_BIN_PATH"On macOS this becomes:
chown root:wheel /usr/local/bin/mailpitwhich succeeds.