diff -Naur pre_patch/spades_compile.sh post_patch/spades_compile.sh
--- pre_patch/spades_compile.sh	2024-05-26 14:36:40
+++ post_patch/spades_compile.sh	2024-05-27 13:00:03
@@ -37,10 +37,10 @@ check_whether_OPTARG_is_an_integer() {
 }
 
 # return the argument first character
-str_head() { echo "$(expr substr "$1" 1 1)"; }
+str_head() { echo "${1::1}"; }
 
 # return the argument without the first character
-str_tail() { echo "$(expr substr "$1" 2 $((${#1}-1)))"; }
+str_tail() { echo "${1:1}"; }
 
 print_help() {
   echo
@@ -221,11 +221,21 @@ else
   ADDITIONAL_FLAGS="$ADDITIONAL_FLAGS -DSPADES_BUILD_INTERNAL=OFF"
 fi
 
-cd "$WORK_DIR"
-cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$PREFIX" $ADDITIONAL_FLAGS "$BASEDIR/src"
-make -j $AMOUNT_OF_THREADS
-make install
-cd "$PREFIX"
+if [[ `uname` == "Darwin" ]]; then
+        export CONFIG_ARGS="-DCMAKE_FIND_FRAMEWORK=NEVER -DCMAKE_FIND_APPBUNDLE=NEVER"
+       export CFLAGS="${CFLAGS} -Wunused-command-line-argument"
+       export CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY"
+else
+        export CONFIG_ARGS=""
+fi
+
+cd "${WORK_DIR}"
+cmake -S "${BASEDIR}/src" -B . -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="${PREFIX}" \
+       -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER="${CXX}" \
+       -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DCMAKE_C_COMPILER="${CC}" \
+       -DCMAKE_C_FLAGS="${CFLAGS}" "${ADDITIONAL_FLAGS}" \
+       "${CONFIG_ARGS}"
+cmake --build . --target install -j "${AMOUNT_OF_THREADS}" -v
 
 if [ $RUN_TESTS = "y" ]; then
   cd "$BASEDIR"
