Apple Inc agreed to pay $50 million to settle a class-action lawsuit by customers who claimed it knew and concealed that the "butterfly" keyboards on its MacBook laptop computers were prone to failure.