Due to a Hard Drive failure I have had to restore my mac from a backup. Following the Restore From Time Machine Backup procedure under recovery mode takes about 8 hours. Eventually the data is restored on the new hard drive, but the drive won't boot. It gets stuck at around 50% of the boot process with the apple logo.
I have tried the Reinstall macOS procedure under recovery mode, but at the end it prompts the message:
OS X could not be installed on your computer
Building boot caches on boot helper partition failed. Quit the installer to restart your computer
This happens for both Mavericks as for Sierra.
What can I do to fix this problem? After several, very long attempts, I am desperate to get my data and mac back.