How to Install OS X on new hard drive on a Late 2012 Mac mini
To avoid having to install OS X twice, do the following.

Before removing your existing hard disk, follow the steps given below:


Download El Capitan (OS X 10.11) from the Mac App Store.
Create a bootable installer for OS X. For this you will need a USB
flash drive.


Both of the above steps are outlined at the Apple web site: "Create a bootable installer for OS".

If you are not able to do follow the instructions on the link above, or are wary or using command lines, download a free tool called Unibeast onto your Mac. It will create the bootable USB device for you. I don't own the tool or promote it so I won't link it but I do recommend it since it helped me. A simple search should bring it up.

If not, the rest of this guide continues:

Once your new disk is installed, do the following.


Insert the flash drive in a USB port on your Mac.
Start the Mac and hold down the option key.
Select to boot from the flash drive.
Use the Disk Utility application to create a single partition to
install El Capitan (OS X 10.11).
Quit the Disk Utility application.
Select "Reinstall OS X".