Install Xcode Development Tools
It's recommended to download the newest Xcode package from the Mac App Store for your system (it's free).
For Xcode 4, you need to install the command line tools additionally. This is do by starting Xcode, going to Preferences. > Download and installing them. For Xcode 5 This should no longer is needed.
Install CMake
CMake is a tool for generating build environments and it supports make and Xcode (among others). Download CMake here.
If you plan to build using SCons, then you can skip this step.
Download sources from Git
Now you're ready for Get the latest Blender source code from blender.org ' s Git repository. Copy and paste the following instructions into a terminal window. These would create a Blender-build folder off your home directory and download the latest source code.
mkdir ~/BLENDER-BUILDCD ~/blender-buildgit clone http://git.blender.org/blender.gitcd blendergit submodule Update-- Init--recursivegit submodule foreach git checkout mastergit submodule foreach git pull--rebase origin master
For additional information on using Git with Blender ' s sources, see:tools/git
Download external libraries from Subversion
The external libraries needed for building blender has been precompiled for Intel and the OS X 10.5+, and C An is download with these commands:
CD ~/blender-buildmkdir LIBCD libsvn Checkout Https://svn.blender.org/svnroot/bf-blender/trunk/lib/darwin-9.x.universal
Updating sources and external libraries
If you later want to update your git and svn checkout to the latest version:
CD ~/blender-build/blendergit pull--rebasegit submodule foreach git pull--rebase origin mastercd ~/blender-build/lib/da RWIN-9.X.UNIVERSALSVN Update
Run CMake to Create makefiles and XCode Project
CMake itself does not build blender, but it generates the build environment for blender. You can either generate Unix makefiles that can is used from the terminal (easy), or generate XCode Project F Iles If you like to work in XCode.
Quick Build with a single Command
The easiest and fastest solution is-build Blender with the default settings, and simply run this in the Terminal:
CD ~/blender-build/blendermake
After the build finished, you'll find Blender.app ready-to-run in ~/blender-build/build_darwin/bin.
Read on if you want to does more advanced configuration.
Configure a New Build with CMake GUI
Note: For CMake to determine the proper location of the Xcode build, it's important that your active version of Xcode is located at /applications/xcode.app.
CMake comes with a command line interface as well as a graphical user interface. Skip to the next sections if you want to use Terminal only. You find the CMake App in your application folder. Double Click on it to start it. The CMake Window shows up:
As you can see all of the sources in ~blender-build/blender and a destination directory Which I has chosen to being ~blender-build/cmake (any location outside of the source directory is allowed).
Now press the "Configure" button. You get another Popup:
Here's can select which Generator you want to use (Unix makefiles or CMake in our case). I have selected Xcode here. Note that you also can select which compiler your want to use. If you're unsure about what the means, don ' t worry and use the default native compilers.
Now press the ' Done ' button. You get the "previous" to the "you'll see a big Red List of options. You can scroll through the option list and set parameters to your needs. Please ensure the following settings is correct for your build:
parameter |
value |
Cmake_build_type |
"Release" (for release build with optimizations) or "debug" (To get debug info for gdb) |
Cmake_osx_architectures |
PPC, i386, x86_64 (x86_64 for all recent OS X versions) note:x86_64 (+ bits) is default and only newer hardware support it. If your build stops with error ' bad CPU type ' in executable ' you have a to switch CPU type to i386 or PPC (. |
Cmake_osx_deployment_target |
You can restrict the OSX version of want to build for (10.5, 10.6, 10.7, 10.8, 10.9), but a nice default is 10.6. |
Cmake_osx_sysroot |
It's recommended to always use the highest SDK available. |
With_codec_quicktime |
Must be set to on if you want to use Apple Media Services (actual qtkit, Avkit soon) |
With_codec_ffmpeg |
Set to on if you want FFMPEG support. |
Cmake_cxx_flags_debug, Cmake_c_flags_debug |
(Advanced mode) set to '-g3-o0-fno-inline ' for best gdb code stepping |
Note: ' GCC ' is a symbolic link to the default compiler used by the desired Xcode version. Since XCode5 This means CLANG, formerly it is LLVM-GCC
Click Configure again and the red highlighting should disappear. Then click Generate and your build environment'll be created into the build folder.
The next steps depend on the type of build files you generated.
Configuring a New Build from and CMake from the Command line
CD to the directory where the Blender/and lib/directories is. Then do the following:
mkdir BUILD_DARWINCD Build_darwincmake. /blender/
This would create all makefiles in the CMake directory, as a "out of source build"
Then run
Ccmake.
Which starts the terminal ' curses ' app to configure build settings. Check the section above for important settings. End with the Commands "C" (Configure) and "G" (generate). Note: You have the to carefully check CPU type and OSX version.
Building Blender
At this point you should has your build environment set up via CMake. Now you can build the actual executable in and different way:from the Command line with make, or with XCode.
Build with Unix makefiles
Open up a Terminal and navigate to the build directory of you created (e.g. Build_darwin). Then just run:
Makemake Install
|
Parallel Builds |
|
For Multi-core/multi processor Systems you can build much faster by passing the jobs argument to make:-j (1+number_o F_cores).
For the example put "-j3" If you had a dual-core or "-j5" If you had a quad-core. For shell-scripts use gnu-syntax:expr ' nproc ' + 1 or Bash-syntax: $ ((' Nproc ' + 1))
If it ' s still not using all your CPU power, leave out the number: "-j" to spawn as many as possible build process ES (usually 64). Note that it could build faster, but make your system lags in the meanwhile. |
Once This completes your should end up with a Blender.app in the directory blender-build/build_darwin/bin .
Building with XCode
Assuming followed the steps above and configured CMake to build into its own folder inside a folder named "Blender-bui LD ", there would be a XCode project located in" Cmake/blender.xcodeproj ".
Double click it to open XCode.
XCode 4
Set the Active Target to Install:
Open the scheme for "Install" target and set "Release" or "Debug", set executable to "Blender.app"
And now build (click on the "Run" button shown in the image)!
When Xcode is finished, Blender would start automatically for testing.
XCode 5
1. Change the Active Scheme popup in the upper left corner of the XCode 5 Project window from all_build To Install
2. Select menu product->scheme->edit Scheme
3. Select the Run item from the left view and you'll see something like this:
4. Select the Blender App from the executable popup menu.
5. Click OK to save changes.
Now clicking the Run triangle next to the Active Scheme popup should now build the application and Launc H Blender under the debugger.
Building with SCons
!!! SCons was refactored in November!!!
SCons'll setup all needed flags automatically depending on the defined architecture.
If you want change desired variables just create a user-config.py in the blender source root dir and add the variables yo U want affect.
Example:for compiling 32bit_intel with Cuda binaries precompiled, save the following text in user-config.py:
Macosx_architecture = ' i386 ' # valid ARCHS:PPC, i386, PPC64, x86_64with_bf_cycles_cuda_binaries = True
After a first successful build, you can afterwards ("Expert mode") tweak the other settings to make an optimized build.
Then launch the build:
Python scons/scons.py-j x
The change "x" to the actual number of CPU cores you has in your system to accelerate the build process.
If everything went fine, the resulting blender.app would reside Here:blender-build/install/darwin/blender.app
Expert Tip:
You can have multiple specialized configs prepared and just use them with:
Python scons/scons.py bf_config=<my_config>-j x
After drastic changes under the source directory structure, you could need to clean your build/install files to overcome build Issues:
Python scons/scons.py Clean
Blender source on Mac OS x compilation (English)