This paper considers an application of reference governor (RG) to automotive diesel aftertreatment temperature control. Recently, regulations on vehicle emissions have become more stringent, and engine hardware and software are expected to be more complicated. It is getting more difficult to guarantee constraints in control systems as well as good control performance. Among model-based control methods that can directly treat constraints, this paper focuses on the RG, which has recently attracted a lot of attention as one method of model prediction-based control. In the RG, references in tracking control are modified based on future prediction so that the predicted outputs in a closed-loop system satisfy the constraints. This paper proposes an online RG algorithm, taking account of the real-time implementation on engine embedded controllers. In order to realize the online RG algorithm, the following three elements are needed: (i) a plant model to predict future behavior of the control system, (ii) an objective function that quantifies how suitable a modified reference candidate is, and (iii) an online optimization algorithm that computes the most suitable modified reference from a set of candidates. For (i), a catalyst temperature model is derived based on thermal exchanges. In regards to (ii), three objective function candidates are considered and, through simulations, one in which a constraint is characterized as a soft constraint by a barrier function that penalizes the constraint violation is chosen. Owing to the parameters in the objective function selected, the resulting transient responses of the catalyst temperature can be tuned. (iii) The optimization algorithm is realized in the RG based on the steepest descent method, which minimizes a nonlinear objective function iteratively online. Finally, an experimental result is shown in which the present RG algorithm is applied to a production vehicle controller. The result shows the applicability and effectiveness of the present method.