diff --git a/compile b/compile
index 1a35d073a5aa5d040fc7e1bf53d69570c3ac3829..8a76f4a062438c59397aee1a1ec5207296886c24 100755
--- a/compile
+++ b/compile
@@ -23,24 +23,35 @@ then
 	./sanityCheck
 fi
 
-ARCH="$(uname -m)"
-if [ "$ARCH" = "x86_64" ]
-then
+case "$(uname -m)" in
+x86_64|amd64)
 	echo "x64 arch"
-	./devTools/tweeGo/tweego_nix64 -o bin/FC_pregmod.html src/ || build_failed="true"
-elif echo "$ARCH" | grep -Ee '86$' > /dev/null
-then
+	if [ "$(uname -s)" = "Darwin" ]; then
+		TWEEGO_EXE="./devTools/tweeGo/tweego_osx64"
+	else
+		TWEEGO_EXE="./devTools/tweeGo/tweego_nix64"
+	fi
+	;;
+x86|i[3-6]86)
 	echo "x86 arch"
-	./devTools/tweeGo/tweego_nix86 -o bin/FC_pregmod.html src/ || build_failed="true"
-elif echo "$ARCH" | grep -Ee '^arm' > /dev/null
-then
+	if [ "$(uname -s)" = "Darwin" ]; then
+		TWEEGO_EXE="./devTools/tweeGo/tweego_osx86"
+	else
+		TWEEGO_EXE="./devTools/tweeGo/tweego_nix86"
+	fi
+	;;
+arm*)
 	echo "arm arch"
 	# tweego doesn't provide arm binaries so you have to build it yourself
 	export TWEEGO_PATH=devTools/tweeGo/storyFormats
-	tweego -o bin/FC_pregmod.html src/ || build_failed="true"
-else
+	TWEEGO_EXE="tweego"
+	;;
+*)
+	echo "unsupported architecture"
 	exit 2
-fi
+esac
+
+$TWEEGO_EXE -o "bin/FC_pregmod.html" src/ || build_failed="true"
 
 # Revert AlphaDisclaimer for next compilation
 git checkout -- src/gui/mainMenu/AlphaDisclaimer.tw
diff --git a/compile-git b/compile-git
index e7c06d2d80ed5f6175056d209c10b802010f823c..a50b484b4223b4300b34187ef2e4be4917faf1f6 100755
--- a/compile-git
+++ b/compile-git
@@ -4,24 +4,36 @@
 ./sanityCheck
 
 HASH="$(git rev-list -n 1 --abbrev-commit HEAD)"
-ARCH="$(uname -m)"
-if [ "$ARCH" = "x86_64" ]
-then
+
+case "$(uname -m)" in
+x86_64|amd64)
 	echo "x64 arch"
-	./devTools/tweeGo/tweego_nix64 -o "bin/FC_pregmod_$HASH.html" src/
-elif echo "$ARCH" | grep -Ee '86$' > /dev/null
-then
+	if [ "$(uname -s)" = "Darwin" ]; then
+		TWEEGO_EXE="./devTools/tweeGo/tweego_osx64"
+	else
+		TWEEGO_EXE="./devTools/tweeGo/tweego_nix64"
+	fi
+	;;
+x86|i[3-6]86)
 	echo "x86 arch"
-	./devTools/tweeGo/tweego_nix86 -o "bin/FC_pregmod_$HASH.html" src/
-elif echo "$ARCH" | grep -Ee '^arm' > /dev/null
-then
+	if [ "$(uname -s)" = "Darwin" ]; then
+		TWEEGO_EXE="./devTools/tweeGo/tweego_osx86"
+	else
+		TWEEGO_EXE="./devTools/tweeGo/tweego_nix86"
+	fi
+	;;
+arm*)
 	echo "arm arch"
 	# tweego doesn't provide arm binaries so you have to build it yourself
 	export TWEEGO_PATH=devTools/tweeGo/storyFormats
-	tweego -o "bin/FC_pregmod_$HASH.html" src/
-else
+	TWEEGO_EXE="tweego"
+	;;
+*)
+	echo "unsupported architecture"
 	exit 2
-fi
+esac
+
+$TWEEGO_EXE -o "bin/FC_pregmod_$HASH.html" src/
 
 #Make the output prettier, replacing \t with a tab and \n with a newline
 sed -i -e '/^<div id="store-area".*$/s/\\t/\t/g' -e '/^<div id="store-area".*$/s/\\n/\n/g'  "bin/FC_pregmod_$HASH.html"