When the bundler takes a long time resolving dependencies, bundler install may fail with a timeout. The bundler by default has a default timeout value of 5 seconds, and it can be increased using the "bundle config timeout <number of seconds>"
For example, you may increase the timeout to 30 seconds by using the command below:
bundle config timeout 30
This setting is currently not documented at bundler's website, but it is found in their code.