title: How do you change the MIME type of a file from the terminal?
body: <p>What I'm looking for is a counterpart to <code>file -I</code> (Darwin; -i on Linux).</p>
  
  <p>For example, given:</p>
  
  <pre><code>$ file -I filename.pdf
  filename.pdf: application/octet-stream; charset=binary
  </code></pre>
  
  <p>I would like to be able to do something like this:</p>
  
  <pre><code>$ [someCommand] filename.pdf application/pdf
  </code></pre>
  
  <p>The result would be that filename.pdf would then be typed as application/pdf.</p>
  
  <p>The reason for the question is that sometimes web servers use the wrong MIME type, which results in programs refusing to open the file.  (Most often text/plain, in my experience.)</p>
  
  <p>I've been searching <code>man</code>, the web and this site for about two and a half hours.  Tried everything from hex dumps to <code>xattr</code> to text editors.</p>
  
  <p>Your help would very much be appreciated.</p>
  
  <p>Chris</p>