Check if brew command exists before using it.