title: Bash check if specific version of brew formula is installed
body: <p>I am making a script in bash to configure some MacOS machines that has some brew formulas installed. I first want to check if a specific version of that formula has been installed. If not installed, the script will install it.</p>
  
  <p>The thing is that I cannot figure out how to check this. E.g. <code>brew ls --versions openssl</code> returns all installed versions. But I want to check for a specific version, kinda similar to gems <code>gem list -i cocoapods -v 1.3.1</code>. The reason for this is that some projects require to have specific versions installed (like openssl).</p>
  
  <p>Is there a possibility to do this? Note that there are some brew formulas to be checked, so I want to keep it as lightweight as possible :)</p>
  
  <p>I have something in mind like this (but with the correct check of course):</p>
  
  <pre><code>if ! NOT_INSTALLED; then #check to see if ruby -v 2.2.2 has been installed
      brew install ruby -v 2.2.2
  else
      echo "Skipping install ruby..."
  fi
  </code></pre>
  
  <p>Thanks in advance!</p>