It's possible that Reveal Debugger Commands installed via Help menu would fail to work in certain cases. The issue would usually manifest itself by Reveal commands not recognized by Xcode's debugger, for example:
(lldb) reveal load
error: 'reveal' is not a valid command.
error: Unrecognized command 'reveal'.
This usually means that Reveal commands were not installed into LLDB. There are currently two known causes for this:
1) A .lldbinit-Xcode
file is present, but doesn't import .lldbinit
Reveal installs its debugger commands by creating or modifying .lldbinit
file in your home directory. This file is loaded by LLDB during debug session startup. However, if your home directory also contains .lldbinit-Xcode
file, it takes precedence over .lldbinit
when the debug session is started by Xcode. Usually .lldbinit-Xcode
includes the contents of .lldbinit
by having the following line in it:
command source ~/.lldbinit
If, however, your .lldbinit-Xcode
file does not contain that line, .lldbinit
file is silently ignored and Reveal debugger commands will not be integrated. To resolve this issue, simply add the aforementioned line at the top of your .lldbinit-Xcode
file. After saving the file, please restart your debugged app in Xcode and try using Reveal commands again.
2) Python interpreter was installed via Homebrew on your machine
To check whether the debugger uses system-provided Python interpreter or one installed using Homebrew, execute commands script
and then sys.executable
in your debugger console. The result could look like this:
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()'.
>>> sys.executable
'/usr/bin/python'
Such output shows that system-provided Python is used. However, if you have the following output instead, this means that LLDB uses Homebrew-installed Python:
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()'.
>>> sys.executable
'/usr/local/opt/python/bin/python2.7'
In such case, one known solution to Reveal debugger commands (and other scripted elements of LLDB) not working is to ensure that your Python installation has six
module available. To install it, run the following command in your Terminal: pip install six
. After that, try restarting your debugged app in Xcode and using Reveal commands again.
If after installing six
the issue persists, it's possible that Homebrew-provided Python needs to be removed in order for debugger commands to work. This can be done using the Terminal command:
brew remove python@2 --ignore-dependencies
This command only removes Python 2.x.x, which is already present in the system (version 2.7.12 as of macOS 10.14 Mojave), so other Homebrew packages should be able to fall back to the system Python.