Improved the Mac rebuild script