Irish UFC lightweight champion McGregor, 28, said: "The fight is on."
It is reported that each fighter could earn $100m (£78.4m) from the bout, which would be one of the richest in boxing history.
Former five-weight world champion Mayweather, widely considered the best boxer of his generation, retired unbeaten in 2015 after 49 bouts.
It followed a successful defence of his WBC and WBA welterweight titles, a victory that equalled Rocky Marciano's career record of 49-0.
Mayweather retired for the first time in 2008 after 39 fights.
Mixed martial artist McGregor, who has never boxed professionally, became the UFC's first dual-division champion in November 2016 and has previously challenged Mayweather to a fight under mixed martial arts rules.
His boxing licence was granted by the California State Athletic Commission in December, allowing him to box in the US state.
UFC president Dana White, who took part in negotiations on behalf of McGregor, told ESPN: "We have been in talks for a while.
"They went smooth. Floyd Mayweather surrounds himself with smart people and we got the deal done. The impossible deal is now done."
He added: "I'm not saying Conor McGregor's going to win. I'm not saying Floyd Mayweather's going to win.
"But the reason Conor McGregor's as big as he is is he'll fight anybody, anywhere, anytime. He will go after Floyd Mayweather and he will try to knock him out." PLACE YOUR TEXT ADVERT BELOW:>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Make Between =N=1,000,000 to =N=2,500,000 In the next 7 Days from simple Importation Business like we did. Click HERE FOR FREE Details right now Warning To Men: This 3 Foods Is Killing Your Erection. Click Here To Know Them