From 9375f67b3bb612314d4e8bd9821210e66e89dc89 Mon Sep 17 00:00:00 2001 From: Karsten Dambekalns Date: Tue, 11 Mar 2025 12:59:27 +0100 Subject: [PATCH] Allow to install on Apple Silicon with Rosetta enabled Fixes #33 --- install.yaml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/install.yaml b/install.yaml index 693bd16..c970578 100644 --- a/install.yaml +++ b/install.yaml @@ -12,9 +12,21 @@ pre_install_actions: # https://github.com/microsoft/mssql-docker/issues/734#issuecomment-1382358649 #ddev-nodisplay #ddev-description:Check architecture type for incompatible arm64 type - if [ "$(arch)" = "arm64" -o "$(arch)" = "aarch64" ]; then - echo "This package does not work on arm64 machines"; - exit 1; + # If cpu is Apple branded, use arch binary to check if x86_64 code can run + if [[ "$(sysctl -n machdep.cpu.brand_string)" == *'Apple'* ]]; then + if arch -x86_64 /usr/bin/true 2> /dev/null; then + echo "To make this package work on arm64 machines, Rosetta is used."; + else + echo "This package does not work on arm64 machines, unless Rosetta is enabled."; + echo "If needed, run /usr/sbin/softwareupdate –install-rosetta –agree-to-license"; + echo "Make sure Rosetta is enabled in your Docker provider."; + exit 1; + fi + else + if [ "$(arch)" = "arm64" -o "$(arch)" = "aarch64" ]; then + echo "This package does not work on arm64 machines"; + exit 1; + fi fi - | # If there was an existing .ddev/web-build/Dockerfile.sqlsrv we need to remove it