1

I have trouble with name resolution when using programs like gem in my shell within my office environment.

Whenever a program needs to connect to a remote host, it fails to resolve the domain name, but after a "manual resolution" e.g. via dig or ping the same command will succeed.

Basically, this is what I have to do now:

$ gem install guard-sass
ERROR:  Could not find a valid gem 'guard-sass' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - no such name (https://rubygems.org/latest_specs.4.8.gz)
ERROR:  Possible alternatives: guard-sass
$ ping rubygems.org
PING rubygems.org (54.245.255.174): 56 data bytes
Request timeout for icmp_seq 0
^C
--- rubygems.org ping statistics ---
3 packets transmitted, 0 packets received, 100.0% packet loss
$ gem install guard-sass
Fetching: guard-sass-1.3.2.gem (100%)
Successfully installed guard-sass-1.3.2
Parsing documentation for guard-sass-1.3.2
Installing ri documentation for guard-sass-1.3.2
1 gem installed
$ 

This problem is not specific to one command or programming language, but rather occurs on any of the following:

  • gem - Uses ruby under the hood
  • composer - Uses php
  • vagrant - Uses ruby
  • brew - Uses ruby
  • git - Uses C

System:

  • Mac OS X 10.9 (Had the same issue on 10.8 as well)
  • zsh

It does not affect any browsers or other applications with a GUI.

The problem doesn't occur in other environments (e.g. at home) with the same machine.

Any idea on how to troubleshoot this kind of problem?

Follow up:

  • I get both IP address and DNS server address via DHCP both at the office and at home.
  • I also tried using an external DNS server like Google's 8.8.8.8.
  • The Mac only goes to sleep while transferring between office and home (no full reboot).
  • I tried both using the same shell and opening a new session when experiencing this issue at the office. Also tried a full restart of the computer and flushing DNS cache (dscacheutil -flushcache;sudo killall -HUP mDNSResponder).
Felix
  • 111
  • 2
  • May this question be better suited for superuser? I can't tell (it is, after all, a problem with a office environment) but can transfer it, if requested. – Felix Nov 20 '13 at 12:42
  • 1
    What are your connection settings? Are you using DHCP? If so, are you using DHCP to get the DNS servers or are they set static while DHCP only sets the IP address? Are you powering down the machine to move it from home to work, or simply sleeping it? (I'm assuming it's a laptop of some sort.) Are you opening a new shell after switching environments, or is the shell persistent between environments? – John Nov 20 '13 at 13:44
  • Thanks for your response, John. I've edited my post to include the additional information requested. – Felix Nov 20 '13 at 15:22

0 Answers0