To improve the accuracy of five-axis machine tools, the measurement and compensation of position-dependent geometric errors (PDGEs) for rotary axes are of great importance. A double ball bar-based measuring method is proposed to precisely calibrate PDGEs. For each rotary axis, five measuring patterns are designed, in which the ball bar is sensitive to one direction throughout the measuring process. In the measurement, the ball bar functions as a high-precision displacement sensor with a single degree of freedom. Based on the ball bar readings, analytical solutions for 10 PDGEs, except for two angular position errors, are simply deduced. Simulations are conducted to analyze the influence of PDGEs and setup errors on measuring patterns. The advantages of the proposed method are discussed by comparison with three other measuring schemes. Finally, experimental verification of this approach is conducted on a five-axis machine tool. The results confirm that the method provides precision results of PDGEs for rotary axes.