Hanrahan, a two-time All-Star, posted a 2.59 ERA with 82 saves in 238 appearances for the Pirates from 2009-12. Pittsburgh dealt him and Brock Holt to Boston in December 2012 and netted Mark Melancon as part of the return.
Hanrahan, 35, last pitched in the Majors with the Red Sox in 2013. He signed a pair of Minor League deals with the Tigers after that but never appeared in a game with Detroit. He had Tommy John surgery in May 2013 and again in March 2015.
• Spring: Tickets | Ballpark | 40-man roster | NRIs
"I know he had great passion for pitching and for the game. Really, the game got unplugged on him earlier than he wanted it to," manager Clint Hurdle said. "He kept trying and it kept not working. That's when I started thinking there might be a pilot light lit somewhere here."
Hurdle saw Hanrahan twice during the offseason and heard the former closer was interested in joining the coaching ranks.
"You never know where the next really good coach is going to come from," Hurdle said. "It's not about the pedigree. It's not about the back of the baseball card all the time. Different great coaches come from different realms.
"He's going to get an opportunity to find out how much he has learned, because when you attempt to teach, that's when you really find out what kind of message you can deliver and who you can connect with. I'm really looking forward to his opportunity."
Adam Berry has covered the Pirates for MLB.com since 2015. Follow him on Twitter and Facebook, read his blog and listen to his podcast. This story was not subject to the approval of Major League Baseball or its clubs.