## Building / Debugging Blender [Building blender for OSX](https://wiki.blender.org/wiki/Building_Blender/Mac) At the moment, I use VS code to build / debug blender. [This video](https://youtu.be/P9yeMrtA_rY) is great to get started on the internals of blender. VS code `task.json`: ```json { "version": "2.0.0", "tasks": [ { "label": "Build Blender", "type": "shell", "command": "make debug developer ccache ninja", "group": "build" }, { "label": "Lite Build Blender", "type": "shell", "command": "make CC='ccache gcc' lite", "group": "build" } ] } ``` VS code `launch.json`: ```json { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(lldb) Launch Blender", "type": "lldb", "request": "launch", "program": "${workspaceFolder}/../build_darwin_debug/bin/Blender.app/Contents/MacOS/Blender", "args": [ "/Users/user_name/projects/blender/dev/blend_file_name.blend", "--debug-all" ], "terminal": "integrated", "stopOnEntry": false, "cwd": "${workspaceFolder}", "preLaunchTask": "Build Blender" // Optional; you can use if you want it to build before launching }, // For building lite version { "name": "Lite (lldb) Launch Blender", "type": "lldb", "request": "launch", "program": "${workspaceFolder}/../build_darwin_lite/bin/Blender.app/Contents/MacOS/Blender", "args": [ "--debug", "--debug-memory", // "--debug-python", // "--debug-ghost", // "--debug-wm", // "--debug-depsgraph", // "--debug-depsgraph-eval", // "--debug-depsgraph-build", // "--debug-depsgraph-no-threads", // "--debug-depsgraph-pretty", "--debug-events", // "--debug-handlers" ], // I usually have all of the flags listed, and commented out. That way I can toggle them on as needed. "terminal": "integrated", "stopOnEntry": false, "cwd": "${workspaceFolder}", "preLaunchTask": "Lite Build Blender" } ] } ``` Some notes: 1. I've specifed a target blend file `/Users/user_name/projects/blender/dev/blend_file_name.blend`, so I can easily launch a buggy blend file for testing 2. I'm using the [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb) plugin which allows me to use the integrated terminal in VS code (the `"terminal": "integrated"` option) 3. The `"args": ["--debug-all"]` flag turns _everything_ on. Which can be a bit much. I usually list them all out, and comment out the one I'm not using at the moment. A list of debug flags can be found [here](https://docs.blender.org/manual/en/latest/advanced/command_line/arguments.html#debug-options)