I had some problems with this in a virtual machine. The VM intentionally did not have access to the Internet (sneaker-net test machine), but it still had some DNS servers configured.
For instance:
$ gem install bundler-1.7.7.gem --local ERROR: While executing gem ... (Errno::ENETUNREACH) Network is unreachable - sendto(2) for "192.168.1.10" port 53
192.168.1.10 is the DNS server configured for VirtualBox. So I needed to comment on /etc/resolv.conf with; at the beginning of all lines. Even going to Google DNS will break it.
; /etc/resolv.conf nameserver 8.8.8.8 ; nope. gem install
If you comment out all /etc/resolv.conf, then you can install gems locally (from a file). It seems.
$ gem install bundler-1.7.7.gem --local Successfully installed bundler-1.7.7 Parsing documentation for bundler-1.7.7 Installing ri documentation for bundler-1.7.7 Done installing documentation for bundler after 4 seconds WARNING: Unable to pull data from 'https://rubygems.org/': no such name (https://rubygems.org/specs.4.8.gz) 1 gem installed
Ruby gems version: 2.4.4 on Ruby 2.1.5.
source share