```ruby
rescue TSort::Cyclic => e
  gemstr = e.message.scan(/@name="(.*?)"/).flatten.join(" and ")
  puts "The gems #{gemstr} each depend on the other, and so this bundle cannot be installed."

#=> "The gems bar and foo each depend on the other, and so this bundle cannot be installed."
```