The math is well known, and many libraries exist. I bet you could replace the OS X and Mac hardware with more cost effective hardware and software with an engineering effort in the low man years, if not less. Which would presumably pay back pretty quickly.