copied directly from local homebrew