The 21-year-old full-back made just two appearances for the Light Blues this season after a campaign blighted by injury and has now decided to move on in search of regular first-team football.
Northern Irishman Hegarty joined Rangers in 2010 from Millwall before making his senior debut two years later.
He won a Third Division championship medal following the Ibrox club's liquidation but has struggled to find fitness and form this term.
He said: "I fulfilled an ambition by playing for a team I grew up supporting and I'll always be grateful for the opportunity.
"I had a bad time with injury last season and at this important stage of my career. I need to play first-team football week in week out and the manager was good enough to let me go and pursue that.
"I'd like to thank physio Steve Walker and Doc Jackson for all their work getting me back to full strength, the gaffer (manager Ally McCoist) and his team, and of course the loyal Rangers supporters, who - as players - we are honoured to represent.
"I wish the team all the best in the Championship next season and I look forward to returning to Ibrox as a fan."