From BlenderWiki

Jump to: navigation, search

Building Blender for OSX

Building Blender for OSX needs a bit of preparation. However the steps are not very complicated and if you follow the instructions carefully you should be able to build Blender.

Build steps in a nutshell

  • Install Xcode Development Tools
  • Install CMake
  • Download sources from Git
  • Download external libraries from Subversion
  • Optional: Install CUDA Toolkit 8
  • Run CMake to create makefiles and XCode project
  • Use make or XCode to build Blender.

Install Xcode Development Tools

Download the newest Xcode package from the Mac App Store for your system (it's free).

Install CMake

CMake is a tool for generating build environments and it supports make and Xcode (among others). Download CMake here.

Download sources from Git

Now you are ready to get the latest Blender source code from Blender.org's Git repository. Copy and paste the following instructions into a terminal window. These will create a blender-build folder off your home directory and download the latest source code.

mkdir ~/blender-build
cd ~/blender-build
git clone http://git.blender.org/blender.git
cd blender
git submodule update --init --recursive
git submodule foreach git checkout master
git 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 have been precompiled for Intel 32 bit and 64 bit and OS X 10.5+, and can be download with these commands:

cd ~/blender-build
mkdir lib
cd lib
svn 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/blender
git pull --rebase
git submodule foreach git pull --rebase origin master
 
cd ~/blender-build/lib/darwin-9.x.universal
svn update

Building

Quick Build from the Terminal

The easiest and fastest solution is to build Blender with the default settings, and simply run this in the Terminal:

cd ~/blender-build/blender
make

After the build finished, you will find blender.app ready to run in ~/blender-build/build_darwin/bin.

Build as an Xcode project

If you like to work with the Xcode IDE and build Blender from within it, you need to generate an Xcode project.

Generating the Project

Find the CMake App in your Application folde and double click on it to start it.

Cmake-OSX-config-initial.png

As you can see all you have to enter is the location of the sources in ~/blender-build/blender and a destination directory which i have chosen to be ~/blender-build/cmake (any location outside of the source directory is allowed).

Now Press the "Configure" Button. You get another Popup:

Cmake-OSX-config-generator.png

Here you can select which generator you want to use, choose Xcode. Now press the '"Done'" Button.

You get back to the previous seen but now you will see a big red list of options. You can scroll through the option list and set parameters to your needs. Click Configure again and the red highlighting should disappear. Then click Generate and your build environment will be created into the build folder.

Building Blender in Xcode

Now you can go to the folder where you generated the project, and double click Blender.xcodeproj to open it in Xcode. Choose "Automatically Create Schemes" if asked.

1. Change the Active Scheme popup in the upper left corner of the XCode 5 project window from ALL_BUILD to Install
Dev-Doc-Building-Blender-XCode5-active-scheme-popup.png

2. Select menu Product->Scheme->Edit Scheme

Edit Scheme is located all the way at the bottom of the list of targets. Or just Press Command-<.
3. Select the Run item from the left view and you will see something like this:
Dev-Doc-Building-Blender-XCode5-Default-SchemeEditPanel.png
4. Select the Blender App from the Executable popup menu.
Dev-Doc-Building-Blender-XCode5-Select-Executable-Blender.png
You may leave the Debugger options at the defaults.

5. Click OK to save changes.

Now clicking the Run triangle next to the Active Scheme popup should now build the application and launch Blender under the debugger.