How to install ImHex on Ubuntu 20.04

soji256
4 min readJan 28, 2021

ImHex is a relatively new Hex editor, released in December of 2020, for Reverse Engineers, Programmers and people that value their eye sight when working at 3 AM.

GitHub — WerWolv/ImHex

We will install ImHex on Ubuntu 20.04 with some modifications from the official procedure.

Note that the make command took up about 6GB of memory, so it is recommended to prepare an environment with 8GB of memory. On a 4GB memory environment, my computer froze during make :D

Installing ImHex

# if necessary.
sudo apt update && sudo apt upgrade
git clone https://github.com/WerWolv/ImHex.git
cd ImHex
# all-in-one dependency installation scripts for Ubuntu.
sudo ./dist/get_deps_debian.sh
mkdir build
cd build
# Patch to fix cmake file to avoid errors in certain environments.
cat <<EOL >> cmakepatch.txt
55,56c55,61
< list(REMOVE_AT PYTHON_VERSION_MAJOR_MINOR 2)
< list(JOIN PYTHON_VERSION_MAJOR_MINOR "." PYTHON_VERSION_MAJOR_MINOR)
---
> list(LENGTH PYTHON_VERSION_MAJOR_MINOR PYTHON_VERSION_LENGHT)
> if(PYTHON_VERSION_LENGHT GREATER 2)
> list(REMOVE_AT PYTHON_VERSION_MAJOR_MINOR 2)
> list(JOIN PYTHON_VERSION_MAJOR_MINOR "." PYTHON_VERSION_MAJOR_MINOR)
> else()
> set(PYTHON_VERSION_MAJOR_MINOR \${Python_VERSION})
> endif()
EOL
# Apply patch to cmake file.
patch ../cmake/build_helpers.cmake cmakepatch.txt
# The official procedure gave an error, so an alternative command.
CC=gcc-10 CXX=g++-10 cmake ..
# == Caution =============================================
# 8GB memory or more is recommended.
# On a 4GB memory environment, my computer froze during make.
#=========================================================
make -j

After successfully completing make, prepare the necessary files as described in the official website.

cp -r ../python_libs/lib ./git clone https://github.com/WerWolv/ImHex-Patterns.git
mv ImHex-Patterns/includes ./
mv ImHex-Patterns/magic ./
mv ImHex-Patterns/patterns ./

Now we just need to execute it!

./imhex

If all goes well, an empty ImHex will be started.

When ImHex is started for the first time

ImHex View Settings

You can add the views you need from the menu.

Menu: View

Views can be rearranged by dragging and dropping them.

The view can be rearranged as you like.

You can also load a pattern file from “Load pattern…” under File in the menu. By loading a pattern file, the display will be colored according to the format of the file type. I could not find any way to automatically apply the pattern to the file type.

Load pattern

I set up the interface as shown in the image below.

ImHex

Conclusion

First of all, it looks beautiful. As it is a tool that has just started its development, I got the impression that its operation is a bit unstable and it will be a while before I can use it on a daily basis, but it seems to have various functions, so I am looking forward to its future.

References

ImHex

cmake command

Troubleshooting

Original Article

Update History

  • 2021/01/28 New.

--

--

soji256

Loves cats and CTFs. …ᓚᘏᗢ… [twitter:@soji256] ,CISSP