--- id: unicorn version: "2.1.4" license: BSD License license_treatment: permissive maintenance: active --- # unicorn — Unicorn CPU emulator engine License: permissive · Maintenance: active · Downloads: 1.3M/mo ## What it is and what it does Unicorn is a Python binding to a QEMU-based CPU emulator that lets you execute machine code for multiple processor architectures—ARM, ARM64, MIPS, PowerPC, RISCV, SPARC, S390X, TriCore, X86 (16, 32, 64-bit), and M68K—without needing to run a full operating system. It provides a clean, architecture-neutral API for loading code into memory, setting up registers and memory state, and stepping through instruction execution with fine-grained instrumentation hooks. The package is implemented in pure C with Python bindings, offering high performance through just-in-time compilation and thread-safe design. It runs on Windows, Linux, macOS, and BSD systems. A single runtime dependency (importlib-resources) keeps the footprint minimal. The project is actively maintained with broad platform coverage via prebuilt wheels, making installation straightforward on modern Python versions. Use it for: - Reverse engineering and analyzing binary code without executing it natively on your system. - Testing and validating machine code generation in compilers or code generation frameworks. - Emulating firmware or embedded system code to understand behavior before deployment. - Security research and vulnerability analysis by executing untrusted or malicious binaries in a controlled sandbox. - Educational exploration of CPU architecture and low-level instruction execution. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Unicorn is a Python binding for a lightweight CPU emulator framework that can execute machine code for multiple processor architectures without running a full operating system. Yes, if you need to execute or analyze machine code across multiple architectures in a controlled environment. The permissive BSD License, active maintenance, broad platform support via prebuilt wheels, and minimal dependencies make it a solid choice. Medium install friction is acceptable given the compiled nature of the underlying emulator. Not necessary if you only need high-level language execution or do not work with binary code. ## Install pip install unicorn uv add unicorn poetry add unicorn ## Installing unicorn Before you install: Medium install friction due to compiled wheel dependencies across multiple platforms and architectures. The package is actively maintained with recent commits and has broad prebuilt wheel coverage for modern Python versions and common platforms. License in practice: Distributed under a permissive BSD License, which allows commercial and private use with minimal restrictions—suitable for most projects that do not require copyleft obligations. Quickstart: pip install unicorn import unicorn mu = unicorn.Uc(unicorn.UC_ARCH_X86, unicorn.UC_MODE_32) Requires a C compiler and build tools to compile from source if prebuilt wheels are unavailable for your platform; prebuilt wheels are available for common architectures and operating systems. Verify before relying: - Whether the package's performance characteristics (JIT compilation speed, memory footprint) meet specific emulation workload requirements. - Completeness of instruction set coverage for less common architectures (M68K, SPARC, S390X, TriCore) in practice. - Thread-safety guarantees and behavior in multi-threaded Python applications. ## Package facts - License: BSD License (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 1.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags cpu emulator python, machine code execution, multi-architecture emulation, qemu bindings, instruction emulation, emulation, reverse-engineering, binary-analysis [View on SkillFed](https://skillfed.io/packages/unicorn) · [View on PyPI](https://pypi.org/project/unicorn/)