On newer Mac's that do not come with OS install disks (been a couple/few years now)...or don't have a built-in optical drive...here are the OS install/recovery choices:
1. Recovery partition (OS 10.7 and higher).
Press the 2 keys...command + r...at the beginning of the startup/boot-up process.
2. Bootable USB stick/thumb drive OS installer.
This is something that must be made AFTER downloading an OS installer...but BEFORE doing the install. This is because the installer is auto-deleted after the install. If the bootable USB stick OS installer is not made before installing...then the OS installer needs to be downloaded again to make it. Lots of info on the internet how to make a bootable USB stick Mac OS installer.
3. Internet Recovery.
If someone had a storage device failure (hard drive or SSD)...and installed a brand new one...this new storage device will not have anything on it (no bootable OS or recovery partition). This is where "Internet Recovery" comes in. It is built into all newer Mac's. Probably all Mac's that have had OS 10.7 or higher installed on it.
Here's more info on the various options:
Apple - OS X Recovery restores your Mac with a few clicks.
To the OP: Since you installed Ubuntu....and
IF the recovery partition was lost/erased in the process...then:
- Option #1 won't work for you (no recovery partition).
- Option #2 won't work either if you don't have an external bootable OS install source (disk or USB drive/thumb drive).
- Option #3 (Internet Recovery) may not work either...since I think that Internet Recovery ONLY "kicks in" if the computer "tries" to boot for a specified amount of time (at least a couple/few minutes) and cannot find ANY bootable source to boot from. Since this computer can boot into Ubuntu...then Internet Recovery probably won't "kick-in".
If you want to get OS X installed back onto this computer I would say you need to:
- Have some sort of external way of erasing this computer's storage device (HD or SSD) so no bootable OS is present...and Internet Recovery can "kick in".
- Have an external way of installing the Mac OS (probably via a bootable USB stick installer).
HTH,
- Nick