Detonation has promising applications in advanced propulsion systems, and numerical simulation is widely used to gain insights into the complex interaction between the hydrodynamic flow and chemical reactions involved in detonation. In this work, detonationFoam, an open-source solver for accurate and efficient simulation of compressible reactive flow and detonation are developed based on OpenFOAM. detonationFoam can simulate compressible, multi-component, reactive flow and it can accurately evaluate the detailed transport coefficients using the mixture-averaged transport model. Compared to rhoCentralFoam, the improved HLLC-P approximate Riemann solver is used in detonationFoam and it helps to accurately resolve shock waves appearing in detonation. Besides, the adaptive mesh refinement and dynamic load balancing algorithms are used in detonationFoam, which greatly improves the computational efficiency. Validation tests including homogenous ignition, unsteady diffusion, shock tube problem, premixed flame, planar detonation, double Mach reflection, detonation cellular structure and oblique detonation wave are conducted. These tests demonstrate that detonationFoam can be used to accurately and efficiently to simulate the compressible, multi-component reactive flow and detonation processes. Program summaryProgram Title: detonationFoamCPC Library link to program files:https://doi.org/10.17632/x45zh4nz28.1Developer's repository link:https://github.com/JieSun-pku/detonationFoamLicensing provisions: GPLv3Programming language: C++Nature of problem: Gaseous detonation involves different length scales and complicated chemistry. To accurately and efficiently simulate the gaseous detonation, adaptive mesh refinement needs to be conducted and detailed chemistry should be considered. Besides, the severe load imbalance caused by the chemical source term evaluation may greatly reduce the computation efficiency.Solution method: An open-source solver, detonationFoam is developed based on OpenFOAM. The species equations considering detailed chemistry are solved in detonationFoam and thereby detonation in a compressible, multi-component, reactive flow can be simulated. The adaptive mesh refinement technique and the dynamic load balancing algorithm are incorporated into detonationFoam. It is demonstrated that detonationFoam can accurately and efficiently simulate gaseous detonation.