Avoid use of brew versions, which has been deprecated. Improve version detection and avoid issues with missing brew components. Fixes #151. Fixes #152