Some versions of macOS include xxd with the Command Line Tools. Install them via:
xxd is a command-line tool that creates a hex representation of a given file or standard input. It can also convert that hex dump back into the original binary format. Originally part of the text editor distribution, xxd has become a staple in system administration, reverse engineering, and programming. xxd command not found
Let’s move to the solutions.
Note: xxd is in the vim-common package.