In this study, the optimal design issue of a passive tuned mass damper (TMD) was transformed into the nonsparse control gain matrix optimization problem, and a general passive TMD optimization design method to minimize structural mean square responses or impulse response is therefore proposed. The proposed optimization procedure combines the static output feedback (also known as direct output feedback) algorithm and the updating iterative procedure. The proposed method can be applied to variant design scenario, whether the main structure is single-degree-of-freedom (SDOF) or multidegree-of-freedom (MDOF) structures, undamped or damped structures, subjected to wind disturbances or earthquake excitations. In addition, the proposed method is capable to consider the excitation shaping filter, so the design results are more suitable for practical application. The design procedure of the proposed method is presented, and all the required weighting matrices are introduced and derived in detail. Firstly, the SDOF structures are used as the main structure to demonstrate the correctness of the proposed method. The numerical simulation results verify that the obtained optimal design parameters of TMD were found identical to some cases which contain the analytic solution. The accuracy and feasibility of the proposed design method are confirmed. Finally, a passive TMD is optimally designed for a 5-story MDOF structure subjected to Kanai-Tajimi spectrum comparable earthquakes and a 60-story high-rise MDOF structure subjected to Davenport spectrum comparable wind loads for demonstration.