HowTo :: Install GEF (GDB Plug-in)
Introduction
Install GEF to supercharge your GDB debugging experience with syntax highlighting, automatic context display, and dozens of powerful commands.
What is GEF?
GEF (GDB Enhanced Features) is a powerful plugin that transforms GDB from a basic command-line debugger into a modern, user-friendly debugging powerhouse. It adds:
- Automatic context display showing registers, stack, code, and threads after every step
- Syntax highlighting for assembly and source code
- Memory inspection tools with visual formatting
- Enhanced breakpoints with better visualization
- Exploit development helpers for security research
- Python-based extensibility to add your own commands
If you’ve used GDB and found it difficult to follow what’s happening, GEF solves that problem by showing you everything you need in an organized, colorful interface.
What You’ll Need
Before installing GEF, ensure you have:
- GDB installed with Python support (most modern installations include this)
- Git for cloning the GEF repository
- Python 2.7+ or Python 3.x
- pip package manager for installing Python dependencies
- Root or sudo access to install to
/opt(or choose a user directory instead)
Step-by-Step Installation Guide
Step 1: Verify GDB Python Support
Before installing GEF, confirm your GDB was compiled with Python support:
| |
Expected output:
3.8.10 (default, Nov 14 2022, 12:59:47)
[GCC 9.4.0]
If you see an error like “Python scripting is not supported in this copy of GDB,” you’ll need to reinstall GDB with Python support. On Debian/Ubuntu:
| |
On Fedora/RHEL:
| |
Step 2: Clone the GEF Repository
Navigate to /opt and clone the GEF repository. This location makes GEF available system-wide:
| |
If you don’t have sudo access or prefer a user installation:
| |
Adjust paths in the following steps accordingly (use ~/gef instead of /opt/gef).
Step 3: Run the Installation Scripts
GEF provides convenient installation scripts that configure everything automatically:
| |
What these scripts do:
gef.shinstalls the core GEF plugin by adding a source line to your~/.gdbinitgef-extras.shinstalls additional helper scripts and commands for advanced features
Step 4: Install Python Dependencies
Some GEF features require additional Python packages. Start GDB and check for missing dependencies:
| |
In the GDB prompt, type:
gef➤ gef missing
This command lists any missing Python packages. Install them using pip:
| |
Verification
To verify GEF is installed correctly, start GDB:
| |
You should see colorful GEF startup banner:
| |
Try running a simple program:
| |
You should see GEF’s enhanced context display showing registers, code, stack, and more.
Troubleshooting
Issue: GDB doesn’t load GEF, shows “command not found”
Solution: Check that ~/.gdbinit contains the source line. Add it manually if missing:
| |
Issue: Python import errors when starting GDB Solution: Ensure Python dependencies are installed for the Python version GDB uses:
| |
Issue: GEF commands work but features are missing
Solution: Run gef missing inside GDB and install listed packages.
Issue: Permission denied when cloning to /opt
Solution: Use sudo for the git clone command, or clone to a user directory like ~/gef instead.
Keeping GEF Updated
GEF is actively developed with new features and bug fixes. To update to the latest version:
| |
Or manually pull the latest changes:
| |
Consider setting up a cron job or alias to remind yourself to update GEF monthly:
| |
Next Steps
Now that you have GEF installed:
- Learn the basics: Read our Getting Started with GDB guide
- Explore GEF commands: Type
gef helpin GDB to see all available commands - Configure GEF: Run
gef configto customize colors, context layout, and features - Try debugging: Practice with our Linux Syscalls in Assembly tutorial
- Official GEF Documentation
- Type
gef helpinside GDB for command reference - Type
help <command>for detailed help on any GEF command
See Also
- Getting Started with GDB - Master the fundamentals of GDB debugging
- Installing pyenv - Manage multiple Python versions for GEF dependencies
- Debugging with strace - Complement GDB with system call tracing
- GEF Official Repository - Source code and latest updates