The move is due to “family circumstances” and will take place later this month.
MacRae used to live in Veneto when he played for Venezia Mestre in 2010 and will now return to the region.
“As a family, we needed a change and the opportunity arising at this point with Benetton felt like it was the right match for us,” MacRae said.
“Having previously lived in Treviso, I have a strong connection to that area and I am excited to be continuing my coaching career with the Benetton family.”
Mike Blair, the Edinburgh head coach, is now left with Stevie Lawrie and Gareth Baber in his team, with Lawrie looking after the forwards and Baber the skills and assistant attack coach. The club will now begin a recruitment process for a new defence coach.
MacRae said it was a tough decision and thanked SRU chief executive Mark Dodson and Edinburgh MD Douglas Struth for their understanding.
“I’d like to thank Mark Dodson, Douglas Struth and Edinburgh Rugby for facilitating this move at short notice,” he said. “It’s a decision I haven’t taken lightly and one my family aBen Muncaster heard about his Scotland call-up on the toilet in South Africand I have given a great deal of thought to.
“On a personal note, I want to express how much I have enjoyed working with Mike, Stevie and Gareth this year and feel that I am leaving the club in a strong position having played a part in qualifying for the Champions Cup again next season.
“I have every faith that the club will continue to go from strength to strength under Mike.”
MacRae, nicknamed ‘Kitty’, joined the club in 2017 following three years as Scotland Sevens head coach – during which time the Scots claimed back-to-back London Sevens titles.
Blair said: “I’ve enjoyed working with Kitty this season. He’s developed into a very good coach and has certainly had a big impact on how we’ve performed this past year.
“When Kitty approached me recently to discuss the move, it was clear this was a decision he’s not taken lightly.
“I want to thank Kitty for his hard work and dedication during his time in Edinburgh. He’ll be missed by all the management, staff and players."
Struth, added: “While we’re obviously disappointed to see Kitty move on after five great seasons in Edinburgh, he does so with the full blessing of the club.
“It was clear that the he and his family were keen to experience a new lifestyle, and he’s fortunate that a new opportunity has arisen in Treviso to accommodate this.
“All of us at the club have enjoyed working with Kitty and we wish him and his family the very best as they settle into a new home.”