title: Failed to build gem native extension - solution
body: <p>When I install gem <code>&lt;insert gem name&gt;</code> it fails with error <code>ERROR: Failed to build gem native extension.</code></p>
  
  <p>For example, when I try to install gems json, eventmachine, mysql2 on a new server it almost always fails.</p>
  
  <p><strong>NOTE</strong>: This is a QA-type question, i.e. please see below for the solution proposed by me or join the discussion.</p>