To get a list of the names of your gems, do
gem list --no-versions. Make a directory (such as
gem-exports) Save that list to a file inside that directory, then remove the headers and empty lines. (The automation options are for *nix systems.)
Take that list and
xargs gem unpack < $LISTNAME
inside the directory. This should take the gem names and run a
gem unpack $GEMNAME on all of them. You will now have all of the gems' sources in their respective directories. Copy the directory to the new OS.
You can then, in the directory, run
xargs -I gemname gem build gemname/gemname.gemspec < $LISTNAME
This should build all the gems you just exported, without needing an internet connection. IF you have a connection, then you can just
xargs gem install < $LISTNAME
That will install the latest versions of all of them.