It is a problem that appeared when I first updated to macOS Sierra yesterday.
GDB itself is running OK. However, somehow, it cannot run my program. When I type \'run
This is due to a Runtime Integrity Protection feature in Sierra - you can deactivate it by following the instructions here.
- Reboot your system Keep command+R pressed until the Apple logo appears on the screen.
- Select the menu Utilities/Terminal Type "csrutil enable --without debug" in the terminal
- Finally, reboot your machine again
Note that disabling this will lower the security of your system, so doing the above should really be your decision.
Another impact of this change is that the DYLD_LIBRARY_PATH variable is no longer reset when spawning new processes via the shell. This variable is used by the dynamic linker to find dynamic libraries. It takes precedence over the search path coded in the executables, so is considered as unsafe by the OS. As a result, macOS by default unsets the variable so that the executable you spawn uses its own libraries. We recommend using the DYLD_FALLBACK_LIBRARY_PATH instead, which comes after the application's library search path, in case some libraries are still not found.