Tutorial: How to debug UnrealBuildTool with Rider on MacbookPro 2023 (macOS Ventura 13.3.1)

These step are for Unreal 4.27.2 source code version + Rider 2023.1 + MacbookPro 2023(M2 Max) + macOS Ventura 13.3.1(a).

Steps

  1. Copy the Engine/Build/BatchFiles/Mac/Build.sh file and rename it to Build-Tmp.sh.
  2. Open Build-Tmp.sh, and modify line 31 (mono Engine/Binaries/DotNet/UnrealBuildTool.exe "$@") to: mono --debugger-agent=address=localhost:34567,server=n,transport=dt_socket --debug Engine/Binaries/DotNet/UnrealBuildTool.exe "$@"
  • This step is to start mono in debug client mode. localhost:34567 is the address and port of the debug server to connect to after starting.
  1. Open Rider, then open UnrealBuildTool.cs, and set a breakpoint, such as L560 (code int Result = Mode.Execute(Arguments);). Then click the drop-down menu of the run target location in the toolbar → Edit Configurations → Upper left corner + sign → .NET → Mono Remote → In the generated page, change Port to 34567 which was written in the previous step → Check Listen for incoming connections. The name of this Configuration can be any name you like, named UBT here.
  • This step is to set a breakpoint in the UBT project. And make a Debug configuration so that Rider can run a debug server to receive the debug client configured in step 2.
  1. Switch Rider to the UBT configuration created in step 3. At this time, only the Debug button is clickable. Click the Debug button, and now it will enter debug server waiting status.
  2. Open Terminal and cd to the location where Build-Tmp.sh is located, then run command ./Build-Tmp.sh UE4Editor Mac Development -buildscw.
  3. At this point, the UBT process running on the command line will start a debug client and connect to the debug server already started by Rider, and then hit the breakpoint. The effect is shown below:

My Chinense Original Version: Mac 平台,Rider debug UnrealBuildTool - 知乎