@@ -74,26 +74,13 @@ Additionally, Visual Studio is required to compile in *Windows*.
7474
7575- # ### macOS installation
7676
77- ** Homebrew is the recommended method** for installing dependencies on macOS (Intel and Apple Silicon).
78-
79- First, [install Homebrew](https://brew.sh/) if not already installed:
77+ Use Homebrew:
8078 ` ` ` Shell
8179 /bin/bash -c " $( curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh) "
80+ brew install cmake llvm boost python@3.14 ninja ccache
8281 ` ` `
8382
84- Then install the required dependencies:
85- ` ` ` Shell
86- brew install cmake llvm boost python@3.14
87- ` ` `
88-
89- ** Important:** macOS' s system clang compiler lacks OpenMP support. The `llvm` installation from Homebrew provides `libomp` which is required. When building Kratos, you must explicitly use the Homebrew LLVM compiler (see configuration examples in the [MacOS build section](#macos) below).
90-
91- Optional but recommended for faster builds:
92- ```Shell
93- brew install ninja ccache
94- ```
95-
96- If you need a specific Python version, Homebrew also provides `python@3.13`, `python@3.12`, etc.
83+ ** Note:** System clang lacks OpenMP. Homebrew' s `llvm` provides `libomp` (required for builds).
9784
9885- #### Windows installation
9986
@@ -624,165 +611,64 @@ fi
624611
625612# ### System Requirements
626613
627- ** Supported Versions:** macOS 11.0+ (Intel and Apple Silicon M1/M2/M3+)
628-
629- ** Recommended:** Use Homebrew for dependency management. The following dependencies must be installed:
614+ macOS 11.0+ (Intel or Apple Silicon). Install dependencies via Homebrew:
630615
631616` ` ` bash
632- # Install Homebrew (if not already installed)
633617/bin/bash -c " $( curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh) "
634-
635- # Install required dependencies
636- brew install cmake llvm boost python@3.14
637-
638- # Optional but recommended for faster builds
639- brew install ninja ccache
618+ brew install cmake llvm boost python@3.14 ninja ccache
640619` ` `
641620
642- ** Critical :** macOS system clang lacks OpenMP support. You ** must ** use Homebrew' s LLVM installation, which provides `libomp`.
621+ ** Note :** System clang lacks OpenMP. Homebrew' s `llvm` provides `libomp`, which is required .
643622
644- #### Recommended: Using the Build Script
623+ #### Quick Start
645624
646- Kratos provides a dedicated build script for Apple Silicon that handles all macOS-specific configuration :
625+ Use the provided build script:
647626
648627```bash
649628cd /path/to/Kratos
650629./scripts/mac_build -j4
651630```
652631
653- This script will:
654- - Automatically find Homebrew-installed LLVM and Boost
655- - Detect your Python installation
656- - Install Kratos to your Python site-packages directory
657- - Use the Ninja build system if installed (faster than Unix Makefiles)
658-
659- **Options:**
660- - `-j <N>`: Number of parallel build jobs (default: auto-detected)
661- - `-i <path>`: Custom installation directory (default: Python site-packages)
662- - `-o "<option>"`: Pass additional CMake options
663- - `-C`: Clean build and install directories
664-
665- **Example with custom Python:**
666- ```bash
667- ./scripts/mac_build -o "-DPYTHON_EXECUTABLE=$(which python3)" -j8
668- ```
669-
670- #### Manual Configuration (Advanced)
632+ Options: `-j<N>` (jobs), `-i <path>` (install dir), `-o "<option>"` (CMake options), `-C` (clean)
671633
672- If you prefer to configure manually, follow these steps:
634+ #### Manual Configuration
673635
674- **Step 1: Create a Python Virtual Environment (Recommended)**
636+ For custom setups:
675637
676638```bash
677639python3 -m venv ~/kratos_env
678640source ~/kratos_env/bin/activate
679- pip install --upgrade pip
680- ```
681-
682- **Step 2: Configure with CMake**
683641
684- ```bash
685- # Set paths
686642export KRATOS_SOURCE=/path/to/Kratos
687643export KRATOS_BUILD=$KRATOS_SOURCE/build
688- export KRATOS_INSTALL=$(python3 -c "import sysconfig; print(sysconfig.get_paths()[' purelib' ])")
689-
690- # Create build directory
691- mkdir -p $KRATOS_BUILD
692- cd $KRATOS_BUILD
644+ mkdir -p $KRATOS_BUILD && cd $KRATOS_BUILD
693645
694- # Configure (adjust -j to your CPU core count)
695646cmake $KRATOS_SOURCE \
696- -DCMAKE_INSTALL_PREFIX=$KRATOS_INSTALL \
647+ -DCMAKE_INSTALL_PREFIX=$(python3 -c "import sysconfig; print(sysconfig.get_paths()[ ' purelib ' ])") \
697648 -DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang \
698649 -DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++ \
699650 -DCMAKE_BUILD_TYPE=Release \
700651 -DPYTHON_EXECUTABLE=$(which python3) \
701652 -G Ninja
702- ```
703653
704- **Step 3: Build and Install**
705-
706- ```bash
707654cmake --build . --target install -j$(sysctl -n machdep.cpu.thread_count)
708655```
709656
710- #### Testing Your Installation
711-
712- After successful build, verify the installation:
657+ #### Verify Installation
713658
714659```bash
715- python3 << ' EOF'
716- import KratosMultiphysics
717-
718- # Create a basic model
719- model = KratosMultiphysics.Model()
720- model_part = model.CreateModelPart("TestPart")
721-
722- print("✅ Kratos successfully installed and working!")
723- print(f"Installation path: {KratosMultiphysics.__file__}")
724- EOF
725- ```
726-
727- You should see output similar to:
728- ```
729- | / |
730- ' / __| _` | __| _ \ __|
731- . \ | ( | | ( | \_ _ \
732- _| \_\_ | \_ _,_| \_ _| \_ __/ ____/
733- Multi-Physics X.Y.Z-hash-Release-ARM64
734- Compiled for Mac OS and PythonX.Y with Clang-XX.X
735- Compiled with threading support. Threading support with OpenMP.
736- Maximum number of threads: N.
737- ✅ Kratos successfully installed and working!
738- Installation path: /path/to/site-packages/KratosMultiphysics/__init__.py
660+ python3 -c "import KratosMultiphysics; m = KratosMultiphysics.Model(); print(' ✅ Success' )"
739661```
740662
741663#### Troubleshooting
742664
743- ** Error: " Unable to find KratosCore" or " Symbol not found in flat namespace" **
744-
745- - ** Cause:** Python version mismatch (e.g., compiled for Python 3.12 but running Python 3.14)
746- - ** Solution:** Explicitly specify Python when configuring:
747- ` ` ` bash
748- cmake ... -DPYTHON_EXECUTABLE=/opt/homebrew/opt/python@3.14/bin/python3.14
749- ` ` `
750-
751- ** Error: " libomp not found" **
752-
753- - ** Cause:** LLVM from Homebrew not installed
754- - ** Solution:**
755- ` ` ` bash
756- brew install llvm
757- # Then verify LLVM paths are used in CMake configuration
758- ` ` `
759-
760- ** Error: " Boost not found" **
761-
762- - ** Cause:** Homebrew Boost installed but CMake can' t find it
763- - **Solution:** Explicitly set Boost path:
764- ```bash
765- cmake ... -DBOOST_ROOT=$(brew --prefix boost)
766- ```
767-
768- **Build is slow or using system clang**
769-
770- - **Cause:** System clang is being used instead of Homebrew LLVM
771- - **Solution:** Verify compiler paths:
772- ```bash
773- which clang # Should show /usr/bin/clang, that' s OK
774- # But CMAKE_CXX_COMPILER should point to Homebrew LLVM:
775- echo /opt/homebrew/opt/llvm/bin/clang++
776- ` ` `
777-
778- ** Permission denied on installation**
779-
780- - ** Cause:** Writing to Python site-packages requires appropriate permissions
781- - ** Solution:** Use a Python virtual environment (recommended) or install to custom directory:
782- ` ` ` bash
783- cmake ... -DCMAKE_INSTALL_PREFIX=$HOME /.local/opt/kratos
784- export PYTHONPATH=$PYTHONPATH :$HOME /.local/opt/kratos
785- ` ` `
665+ | Error | Solution |
666+ |-------|----------|
667+ | "Unable to find KratosCore" | Python version mismatch. Use: `-DPYTHON_EXECUTABLE=/opt/homebrew/opt/python@3.14/bin/python3.14` |
668+ | "libomp not found" | Install LLVM: `brew install llvm` |
669+ | "Boost not found" | Set: `-DBOOST_ROOT=$(brew --prefix boost)` |
670+ | Permission denied | Use venv or: `-DCMAKE_INSTALL_PREFIX=$HOME/.local/opt/kratos` |
671+ | Using system clang | Verify CMAKE_CXX_COMPILER: `/opt/homebrew/opt/llvm/bin/clang++` |
786672
787673
788674
@@ -906,42 +792,23 @@ cmake --build "%KRATOS_BUILD%/%KRATOS_BUILD_TYPE%" --target install -- /property
906792
907793#### MacOS
908794
909- * MacOS * has a dedicated build script that automatically configures all macOS-specific settings (compilers, OpenMP, Boost, Python) :
795+ Use the dedicated build script:
910796
911797```bash
912798cd /path/to/Kratos
913799./scripts/mac_build -j4
914800```
915801
916- ** This is the recommended approach** for most users. The script will:
917- - Automatically detect Homebrew-installed LLVM, Boost, and Python
918- - Configure the correct compiler flags for Apple Silicon or Intel Macs
919- - Install Kratos to your Python site-packages directory
920- - Use Ninja if available (faster builds)
921-
922- ** For advanced users** needing custom configuration, see the [MacOS advanced build section](# macos) for manual CMake instructions.
923-
924- ** Mac_build script options:**
925- - ` -j< N> ` : Number of parallel build jobs (default: auto-detected)
926- - ` -i < path> ` : Custom installation directory
927- - ` -o " <option>" ` : Pass additional CMake options
928- - ` -C` : Clean build and install directories
929- - ` -h` : Show help
930-
931- Example with custom Python and more cores:
932- ` ` ` bash
933- ./scripts/mac_build -o " -DPYTHON_EXECUTABLE=$( which python3.13) " -j8
934- ` ` `
935-
936- ** Note:** The older ` scripts/standard_configure_mac.sh` is deprecated. Please use ` scripts/mac_build` instead.
802+ For advanced configuration, see the [MacOS build section](#macos).
803+ **Note:** The older `scripts/standard_configure_mac.sh` is deprecated.
937804
938805Finally you can set parallelism options in the *VisualStudio IDE*.
939806
940807**Warning**: Please be careful while mixing parallel builds with unitary builds. See [below](#unitary-builds)
941808
942809#### MacOS
943810
944- There is no dedicated support for parallel builds in * MacOS * , but * GNU/Linux * options should behave very similarly. If you detect a problem please inform us and we will try to update this section with the specifics .
811+ See [MacOS build section](#macos) for parallel build options.
945812
946813### Building Environment
947814
0 commit comments