John Ternus, Apple's hardware boss, will take over for Tim Cook as CEO starting September 1. Cook will stay on as executive chairman.