This paper is devoted to establishing a nonlinear constitutive model incorporating crack closure effect for capturing the whole process of rock deformation and failure behavior under compression. The model formulated in the framework of irreversible thermodynamics is based on the additive decomposition of the total strain into crack closure strain, elastic, and plastic parts. New specific criteria are proposed for the description of crack closure strain and plastic strain evolution. Notably, analytical solutions of the model under conventional triaxial compression loading conditions are derived. For application, a robust semi‐implicit return mapping (SRM) algorithm with a crack closure strain correction and a plastic strain correction is developed. The analytical solutions, herein, are subtly used to calibrate model parameters and as reference results for assessing the accuracy and robustness of the SRM algorithm. Validation of the model conducted by comparing with experimental data from the literature shows that the model can properly describe the nonlinear mechanical behaviors of rocks, including crack closure effect, strain hardening/softening, peak and residual strength, as well as volumetric compaction/dilation transition. In addition, a nonlocal formulation is introduced as an extension of the model to remedy the mesh dependency problem.