From bb6d51e0d2261da33c60b0420be346e3821ddea1 Mon Sep 17 00:00:00 2001 From: Nayu Date: Sun, 9 Jun 2024 03:59:44 +0200 Subject: [PATCH] On macOS, don't build native GUI if XCode is not installed. MacOS has two way to install tools you need to develop (make, git, cc, ...). Either install Xcode or something called Command Line Tools. But the Command Line Tools version doesn't include all the necessary programs to build Apple applications. For example xcodebuild, which if invoked without XCode installed will tell that xcode is not installed and exit with an non 0 exit code. --- src/Makefile.OCaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Makefile.OCaml b/src/Makefile.OCaml index 3e2fdc3e3..ea5877c3e 100644 --- a/src/Makefile.OCaml +++ b/src/Makefile.OCaml @@ -72,7 +72,14 @@ endif .PHONY: macuimaybe ifeq ($(OSARCH), Darwin) - macuimaybe: macui + # If XCode is not installed, xcodebuild is just a placeholder telling that XCode is not installed + # and any invocation of xcodebuild results in a non 0 exit code. + ifeq ($(shell xcodebuild -version > /dev/null; echo $$?), 0) + macuimaybe: macui + else + macuimaybe: + $(info Not building macOS native GUI because XCode is not installed.) + endif else macuimaybe: $(info Not on macOS. macOS native GUI will not be built.)