I find that every now and again VirtualBox glitches out and fails to install (or update) on macOS. This has happened to me a few times now, and every single time it's because Apple security policies prevent VirtualBox kernel extensions from being loaded.
Attempt 1 of 2: Start with OSXDaily fix: check your "System Preferences > Security & Privacy > General". There might be a discreet note in the lower part of the window saying that kernel extensions from the developer Oracle could not be loaded and an option to whitelist them by clicking on the "Allow" button. Done! :)
Attempt 2 of 2: If the above didn't work then I'm afraid you will have to do the same manually:
Run "VirtualBox_Uninstall.tool" from VirtualBox.dmg
Examine you existing KextPolicy database:
$ sqlite3 /private/var/db/SystemPolicyConfiguration/KextPolicy > select * from kext_policy; > select * from kext_policy where team_id = 'VB5E2TV963'; > delete from kext_policy where team_id = 'VB5E2TV963'; > .quit
This will probably not work because KextPolicy database is in the write-protected area, but it will ensure that the team id where about to add is indeed that of Oracle.
Restart in the RECOVERY mode: reboot, then hold Cmd-R as your mac is powering up
Open "Utilities > Terminal" and ran the following commands (Careful! At this point you are running as
spctl kext-consent list spctl kext-consent add VB5E2TV963
Finally, reboot as normal and re-run Virtual box installer.
VirtualBox should now install without failures!