The paper is concerned with an optimal design problem for a hyperelastic rod. The function describing the position of a point at the line of rod cross-section centroids in its reference configuration is the variable subject to optimization. The necessary optimality condition is formulated. The continuation method combined with the gradient descent algorithm are employed to solve this problem numerically. Numerical results are provided.