 He elected free agency on November 6, 2017.On November 24, 2017, Rivera signed a minor league contract with the Miami Marlins.Rivera's contract was purchased by the Marlins on March 29, 2018, and he was assigned to the Opening Day roster.