For the first time Tuesday, users of Boston’s Hubway bike-sharing program were able to rent helmets with their bicycles, Mayor Thomas M. Menino announced. The first HelmetHub machine was installed at the Hubway location near the intersection of Boylston Street and Massachusetts Avenue in the Fenway, Menino’s office said. The new machine, which the city called the only one of its kind in the United States, will act as a trial during the remaining weeks of the Hubway season. More machines will be added in 2014, the mayor’s office said. Helmets will cost $2 to rent for up to 24 hours and $20 to buy, the city said.

Nicholas Jacques can be reached at nicholas.jacques@globe.com.