McGregor joined Turkish giants Besiktas after leaving Rangers, before then returning to British football by linking up with Hull.
"He is vastly experienced goalkeeper who we feel can add to the options available to us now", Gerrard told the club website.
McGregor will now battle with Wes Foderingham and Jak Alnwick to become the number 1 between the sticks for the Scottish giants.
He has a spell on loan at Cardiff City previous year and has 35 caps at worldwide level with Scotland to his name.
The keeper was out of contract at Hull and turned down the offer of a new deal from the club.
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. He lifted 11 trophies in total for the Ibrox club.
He added: "I started training here when I was 12 years old and it's incredible to be back".
McGregor said: "I can't keep the smile off my face".
The 36-year-old shot-stopper came up through the ranks with Rangers, racking up almost 300 appearances for the club before leaving for Besiktas in 2012.
"We need to make this place (Ibrox) a fortress, where nobody wants to come. If you keep doing that, that's what wins you titles".
Edinburgh-born McGregor admitted he wondered whether he would ever get the chance to return to Rangers. It came as a surprise.