I think you machine is running out of memory during the installation process and that's why PostgreSQL and the different components can't be installed and configured properly. Can you monitor the machine's resources during the installation process to confirm this?
If that's the case, you will need to use an alternative way of installing Ruby in your machine. For example, you can use the Bitnami Ruby Virtual Machine and use it in your computer (they require 1GB of RAM to work)
Happy to help!
Was my answer helpful? Click on