The 36-year-old spent more than 10 years at Ibrox before his 2012 departure for Besiktas.
McGregor has 38 Scotland caps and his form was rewarded with a recall from Alex McLeish recently.
He played all 46 league games as the Tigers finished 18th.
"He is vastly experienced goalkeeper who we feel can add to the options available to us now", Gerrard told the club website.
McGregor, who quit the Ibrox outfit six years in the midst of the club's financial meltdown, said: "When the chance came, it was an absolute no-brainer, so I'm buzzing to be back".
Instead, the 36-year-old has chose to return to Rangers six years after quitting in the wake of the club's financial meltdown.
"I started training here when I was 12 years old and used to come through the main stand maybe twice a week".
The 38-cap Scotland global won three league titles, a hat-trick of Scottish Cups and five League Cup titles during his first Rangers stint.
"If you keep doing that, as we've seen before, that's what wins you titles".
Defoe is a Premier League legend.