How to Fix "xxd command not found" in Linux and macOS Encountering the "xxd command not found" error can be frustrating, especially when you are trying to view binary files, perform hex dumps, or patch a file. This error simply means the xxd utility—a powerful tool usually bundled with the Vim editor—is missing from your system’s PATH.
Here is a quick guide on how to get xxd back on your machine, regardless of your operating system. What is xxd?
xxd is a command-line utility that creates a hex dump of a given file or standard input. It can also convert a hex dump back into its original binary form. While it is technically a standalone tool, it is almost always distributed as part of the Vim text editor package. How to Fix it on Linux
Most Linux distributions do not install xxd by default in their "minimal" versions. To fix this, you need to install the package that provides it. Ubuntu / Debian / Kali / Linux Mint
On Debian-based systems, xxd is often found in the xxd or vim-common package.
sudo apt update sudo apt install xxd # If the above fails, try: sudo apt install vim-common Use code with caution. CentOS / RHEL / Fedora / AlmaLinux
On Red Hat-based systems, you generally need the vim-common package.
sudo dnf install vim-common # Or for older versions: sudo yum install vim-common Use code with caution. Arch Linux
In Arch, xxd is included in the base vim package or as a standalone via xxd. sudo pacman -S xxd Use code with caution. How to Fix it on macOS
MacOS usually comes with xxd pre-installed as part of the system's Vim distribution. If you are seeing "command not found," your PATH might be broken, or you may be using a very stripped-down environment. The easiest fix is to install it via Homebrew: brew install vim Use code with caution.
This will install the latest version of Vim along with a fresh version of the xxd binary. Verifying the Installation
Once the installation is complete, verify that the command works by checking its version: xxd -v Use code with caution.
You should see output similar to xxd 2023-08-25 by Juergen Weigert. Common Alternatives to xxd
If you cannot install packages on your current system, you can often use these built-in alternatives to achieve similar results: hexdump: Usually available on almost all Unix-like systems. Usage: hexdump -C filename od (Octal Dump): A POSIX standard tool. Usage: od -t x1 filename xxd command not found
python: If you have Python installed, you can use a one-liner.
Usage: python3 -c "import sys; print(sys.stdin.read().hex())" < filename
The "xxd command not found" error is almost always solved by installing the vim-common or xxd package through your system's package manager. Once installed, you'll have full access to hex dumping and binary manipulation features.
Are you trying to patch a specific binary or just inspect a file's contents using xxd?
It is a quirky bit of Linux history: the xxd command, a powerful hex dump utility, is actually a part of the Vim text editor project. If you find xxd missing on your system, it’s usually because you’ve installed a "minimal" version of Linux or a different editor like Neovim that doesn't bundle it by default. Why It’s "Interesting"
The xxd: command not found error occurs because the xxd utility is often bundled with Vim rather than being a standalone package. On many minimal Linux installations (like Docker containers or server cores), it is omitted by default. 1. Fast Fix: Installation
To resolve this, install the package that provides xxd for your specific operating system:
Ubuntu / Debian / Kali / Linux Mint:sudo apt update && sudo apt install xxd (or sudo apt install xxd on newer versions)
CentOS / RHEL / Fedora:sudo dnf install vim-common or sudo dnf install xxd Arch Linux:sudo pacman -S vim or sudo pacman -S xxd
macOS:Usually pre-installed, but if missing, use Homebrew: brew install vim Alpine Linux:apk add xxd 2. Troubleshooting common scenarios
The xxd command is a powerful command-line utility used to create hexadecimal dumps of binary files and can even reverse them back into binary format. If you see a "command not found" error, it typically means the utility is missing from your system or is not in your executable PATH. 🛠️ Why is it missing?
On most modern systems, xxd is not a standalone application; it is actually bundled with the Vim text editor (specifically within the vim-common package). If you have a "minimal" installation of a Linux distribution or are working inside a lightweight Docker container, Vim—and thus xxd—might not be installed by default. 🚀 How to Install xxd
You can resolve this error by installing the package that contains xxd using your system's package manager: ubuntu - VS code - xxd: command not found - Stack Overflow How to Fix "xxd command not found" in
Troubleshooting: xxd Command Not Found
The xxd command is a popular tool for creating and viewing hexadecimal dumps of files. It's often used for debugging and reverse engineering purposes. If you're encountering the error "xxd command not found," this write-up will help you troubleshoot and resolve the issue.
Possible Causes
xxd command is part of the vim-common package on many Linux systems. If this package is not installed, the xxd command will not be available.xxd command might be installed, but its location is not in your system's PATH environment variable.xxd might be part of a different package, such as xxd-debian or vim.Solutions
If you have a specific string of hexadecimal characters you found and want to know what it says, you can often just pipe it into printf or Python.
Using Python (available on almost all Linux systems):
# Replace 48656c6c6f with your hex string
python3 -c "print(bytes.fromhex('48656c6c6f').decode('utf-8'))"
Common "Interesting" Hex Strings in CTFs/Puzzles:
48656c6c6f = "Hello"446578746572 = "Dexter"536f6c766564 = "Solved"Tip: If the text looks like gibberish even after decoding, try treating it as Base64 instead of Hex:
echo "SGVsbG8gV29ybGQ=" | base64 -d
xxd should be executable by default. If not:
ls -l $(which xxd)
chmod +x $(which xxd)
sudo apk add xxd
On Debian-based systems, the default Vim installation sometimes omits xxd to reduce dependencies. You need to install the xxd package explicitly.
sudo apt update
sudo apt install xxd
Alternatively, installing the full vim package will also bring xxd:
sudo apt install vim
To verify:
xxd --version
Expected output (example):
xxd V1.10 27oct98 by Juergen Weigert
On some systems, you might need to install an alternative package:
sudo apt-get install xxd-debian
Verification
After applying one of the solutions, verify that the xxd command is working by running:
xxd --version
If xxd is installed correctly, you should see its version number.
Conclusion
If you're getting an "xxd: command not found" error, it usually means
the utility is either not installed or not in your system's PATH
is a staple for creating hex dumps, it is often bundled with other packages rather than being a standalone installation. Network World How to Install xxd
The package name often depends on your operating system or Linux distribution.
The error xxd: command not found usually means the vim-common package (which contains xxd) isn't installed on your system. However, since you mentioned "interesting text," you likely found a hex dump and want to decode it without installing tools.
Here is how to solve the error, and how to decode the text using alternatives.
brew install xxd
Note: Homebrew’s xxd formula is often a standalone package, so you don’t need to install full Vim.
sudo yum install vim-common
Or for newer versions using dnf:
sudo dnf install vim-common