1 2# Building PrusaSlicer on Mac OS 3 4To build PrusaSlicer on Mac OS, you will need the following software: 5 6- XCode 7- CMake 8- git 9- gettext 10 11XCode is available through Apple's App Store, the other three tools are available on 12[brew](https://brew.sh/) (use `brew install cmake git gettext` to install them). 13 14### Dependencies 15 16PrusaSlicer comes with a set of CMake scripts to build its dependencies, it lives in the `deps` directory. 17Open a terminal window and navigate to PrusaSlicer sources directory and then to `deps`. 18Use the following commands to build the dependencies: 19 20 mkdir build 21 cd build 22 cmake .. 23 make 24 25This will create a dependencies bundle inside the `build/destdir` directory. 26You can also customize the bundle output path using the `-DDESTDIR=<some path>` option passed to `cmake`. 27 28**Warning**: Once the dependency bundle is installed in a destdir, the destdir cannot be moved elsewhere. 29(This is because wxWidgets hardcodes the installation path.) 30 31FIXME The Cereal serialization library needs a tiny patch on some old OSX clang installations 32https://github.com/USCiLab/cereal/issues/339#issuecomment-246166717 33 34 35### Building PrusaSlicer 36 37If dependencies are built without errors, you can proceed to build PrusaSlicer itself. 38Go back to top level PrusaSlicer sources directory and use these commands: 39 40 mkdir build 41 cd build 42 cmake .. -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local" 43 44The `CMAKE_PREFIX_PATH` is the path to the dependencies bundle but with `/usr/local` appended - if you set a custom path 45using the `DESTDIR` option, you will need to change this accordingly. **Warning:** the `CMAKE_PREFIX_PATH` needs to be an absolute path. 46 47The CMake command above prepares PrusaSlicer for building from the command line. 48To start the build, use 49 50 make -jN 51 52where `N` is the number of CPU cores, so, for example `make -j4` for a 4-core machine. 53 54Alternatively, if you would like to use XCode GUI, modify the `cmake` command to include the `-GXcode` option: 55 56 cmake .. -GXcode -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local" 57 58and then open the `PrusaSlicer.xcodeproj` file. 59This should open up XCode where you can perform build using the GUI or perform other tasks. 60 61### Note on Mac OS X SDKs 62 63By default PrusaSlicer builds against whichever SDK is the default on the current system. 64 65This can be customized. The `CMAKE_OSX_SYSROOT` option sets the path to the SDK directory location 66and the `CMAKE_OSX_DEPLOYMENT_TARGET` option sets the target OS X system version (eg. `10.14` or similar). 67Note you can set just one value and the other will be guessed automatically. 68In case you set both, the two settings need to agree with each other. (Building with a lower deployment target 69is currently unsupported because some of the dependencies don't support this, most notably wxWidgets.) 70 71Please note that the `CMAKE_OSX_DEPLOYMENT_TARGET` and `CMAKE_OSX_SYSROOT` options need to be set the same 72on both the dependencies bundle as well as PrusaSlicer itself. 73 74Official Mac PrusaSlicer builds are currently built against SDK 10.9 to ensure compatibility with older Macs. 75 76_Warning:_ XCode may be set such that it rejects SDKs bellow some version (silently, more or less). 77This is set in the property list file 78 79 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist 80 81To remove the limitation, simply delete the key `MinimumSDKVersion` from that file. 82 83 84# TL; DR 85 86Works on a fresh installation of MacOS Catalina 10.15.6 87 88- Install [brew](https://brew.sh/): 89- Open Terminal 90 91- Enter: 92 93```brew install cmake git gettext 94brew update 95brew upgrade 96git clone https://github.com/prusa3d/PrusaSlicer/ 97cd PrusaSlicer/deps 98mkdir build 99cd build 100cmake .. 101make 102cd ../.. 103mkdir build 104cd build 105cmake .. -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local" 106make 107src/prusa-slicer 108