Building on OSX - LuxRender Wiki
Luxrender GPL Physically Based Renderer

Building on OSX

Personal tools

From LuxRender Wiki

Jump to: navigation, search


This page describes the process of compiling LuxRender on OS X. If you just want to use the program, you can download the program using the links on the download page instead.

The procedure works on OS X 10.6+ for IntelMacs ( updated nov. 20th 2013 )


  • Install mercurial for checking out the source code
  • Install CMake (2.8-8 or newer). Use the for convenience. Important: Use cmake <= 2.8-9 or >= 2.8-12.2 with OSX 10.9/Xcode 5.1.1 to avoid a bug not finding pthreads.
  • Install QT (4.7.3 still best for universal builds ( 32 and/or 64bit, make sure to get the cocoa-version ), 4.8.5 is also o.k. for 64bit only, never versions are not yet tested.

Get cl.hpp at and place it in:

Xcode < 4.3

Mac OS X <Version>: /Developer/SDKs/MacOSX <Version>.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers

Xcode >=4.3

Mac OS X <Version>: /Applications/ <Version>.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers

Don't forget to place it in the SDK you will be using, or just toss it at all if you want. !!! Updating Xcode may need a repetition of this precedure

All other needed dependencies are located in the "macos" repository and will be downloaded in the next step.

get the source

Create a folder that will contain the source of LuxRender, LuxRays and "macos" (OS X build dependencies), then open a terminal, navigate to that folder and type:

hg clone

hg clone

hg clone

As per january 31th completely moved to bitbucket

NOTE: Cloning luxrays is only required if you are building luxrays separately, see below:

Compile LuxRays

Note: You can skip this point and go on to compiling LuxRender as LuxRays headers and lib are now in macos dependency directory. Compiling LuxRays separately is only necessary if you would like the latest version of the library for some other reason (such as having the latest smallluxgpu)

Important cmake-note: With Xcode 4.3 the default location changed and breakes cmake finding the location and version (, so if you have updated, use CMake 2.8-8 or higher. For more information about Xcode 4.3 changes read here:

Interactive build

If you prefer to use the GUI, the following steps show how to build LuxRays interactively.

Open the CMake gui and go through the following steps:

  1. Fill in the "Where is the source code" field, using the folder where you put the LuxRays source code
  2. Fill in the "Where to build the binaries" field
  3. Click the "Configure" button, select Xcode from the dropdown menu and select the "Use default compiler" option
  4. Click the "Configure" button once more; boost should now be found
  5. Click the "Generate" button
  6. Launch Xcode, open the XCode project, LuxRays.xcodeproj, that has been generated by CMake
  7. Set your preferred architecture by going to the Project menu (Xcode <4.3) or Scheme "ALL_BUILD"( Xcode <=4.3 ), also set "Release" or "Debug" there.
  8. Start build (Cmd-B)

Automatic build

If you prefer to use the command-line or you want to automate the build using a build system here are the necessary steps:

  1. Inside Terminal go to the luxray directory. This is where you cloned the LuxRays repository.
  2. Create a build subdirectory: mkdir build
  3. Go into that directory: cd build
  4. Execute CMake with: cmake -G Xcode -DOSX_UPDATE_LUXRAYS_REPO=TRUE ..
    Please note the "..". The command generates an XCode project
  5. Build LuxRays with: cmake --build . --config Release --target ALL_BUILD

Compile LuxRender

If you want to use the interactive tools then use the following procedure, another section describes how to automate this process.

Launch CMake's GUI and go through the following steps:

1. fill in the "Where is the source code" field, using the folder where you put the Lux source code

2. fill in the "Where to build the binaries" field ( can be in source or a dedicated build_dir )

3. configure ->"xcode" -"Use default compiler"

4. From the OSX_options choose how you want to compile, options are ( default ):

  • option(OSX_OPTION_PYLUX "Build a blender compatible pylux" ON)
  • option(OSX_OPTION_CLANG "Build with CLANG compiler ( XCODE4 )" ON) --> good with Xcode 4 or higher
  • option(OSX_OPTION_LTO "Build with LINK TIME OPTIMISATION ( MAY BREAK NON-SSE4 MACS COMPATIBILITY )" ON) --> performs LTO on all binaries except LuxRender ( due Qt )
  • option(OSX_OPTION_UNIVERSAL "Force compile universal" OFF)
  • option(OSX_OPTION_USE_MAX_SSE ""Build with highest SSE available on machine" OFF) --> checks for max sse-type available on machine and uses it

5. press configure once more

6. press generate; an Xcode project file will be created

7. open the XCode project file in Xcode

8. build target DYNAMIC_BUILD" (set to Release or Debug ). If you are using Xcode 4, you can quickly launch a debug build by selecting Product > Build. The proper target will most likely not be the active target when you open the Xcode project, so select in manually.

Hint: If you want to deploy LuxRender complete "dependency-less", use macdeployqt for bundling used Qt-frameworks into the app-bundle. You can find this option in cmake/macosx_bundle.cmake file

Automatic procedure

From the Terminal execute the following commands:

  1. cd to where you have the LuxRender codebase
  2. mkdir build
  3. cmake -G Xcode -DQT_QMAKE_EXECUTABLE=[Full path of qmake] ..
  4. cmake --build . --config Release --target ALL_BUILD
  5. You will need to package the executable with the Qt libs. This is done by running:
    1. cd build/Release
    2. macdeployqt
  6. Please note that you might need to prefix macdeployqt with the full path where you have Qt installed.

Test Scenes

You can download the "testsuite" in to have a render.