Move some brew specific code into if statement