In this paper, an intelligent reflecting surface (IRS) is deployed to assist the terahertz (THz) communications. The sum-rate of user equipments (UEs) is maximized while guaranteeing the rate requirement of each UE. A block coordinate searching (BCS) algorithm is proposed to jointly optimize the IRS's coordinates, phase shifts, THz sub-bands allocation and power control. Specifically, the relaxation with penalties based (RPB) algorithm is developed to guarantee the feasibility of obtained IRS's coordinates and the monotonicity of objective value. In addition, to optimize the IRS's phase shifts, the sub-gradient descent (SGD) algorithm is proposed, where the IRS phase shifts are formulated as closed-form expressions with introduced pricing factors. Simulation results show that the proposed scheme can significantly enhance system performance.