title: Removing old versions of gems
body: <p>For some gems on my machine, there are multiple versions:</p>
  
  <pre><code>$gem list bigdecimal
  bigdecimal (1.2.6, 1.2.5)
  
  $gem list io-console
  io-console (0.4.3, 0.4.2)
  
  $gem list json
  json (1.8.2, 1.8.1)
  
  ...
  </code></pre>
  
  <p>I want to remove the old versions. I tried several commands:</p>
  
  <pre><code>$gem cleanup
  Cleaning up installed gems...
  Clean Up Complete
  
  $sudo gem cleanup
  Cleaning up installed gems...
  Clean Up Complete
  
  $gem cleanup json
  Cleaning up installed gems...
  Clean Up Complete
  
  $sudo gem cleanup json
  Cleaning up installed gems...
  Clean Up Complete
  </code></pre>
  
  <p>but the old versions are not removed. Why are the old versions not detected by <code>cleanup</code>? How can I remove them?</p>
  
  <p><strong>Update</strong> Strange thing is that, I can manually uninstall the newer versions but not the old ones. For example,</p>
  
  <pre><code>$ sudo gem uninstall json --version 1.8.1
  ERROR:  While executing gem ... (Gem::InstallError)
      gem "json" cannot be uninstalled because it is a default gem
  
  $ sudo gem uninstall json --version 1.8.2
  Successfully uninstalled json-1.8.2
  </code></pre>
  
  <p><strong>Update</strong> What is a default gem? Why can't it be deleted?</p>
  
  <p><strong>Update</strong> If I have a default old version, does it mean that a newer version is not in use and the default one is called by the command <code>require</code>?</p>