This problem occurs due to the default ruby environment
To resolve this you can give a ‘gem cleanup’ and check the things that work for you or not.
If this won’t work follow the commands given below
gem update -p
rvm reinstall ruby-2.5.1 --with-openssl-dir=/usr/local
gem install fastlane --verbose
This will fasten your things and will not be stuck anymore.