第一次在mac安装遇到如下问题:
截图:
具体code如下:
Sonofelice:bch-flowrouter baidu$ brew install openresty/brew/openresty Updating Homebrew... ==> Homebrew has enabled anonymous aggregate user behaviour analytics. Read the analytics documentation (and how to opt-out) here: https://docs.brew.sh/Analytics.html xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun Error: Failure while executing: git config --local --replace-all homebrew.analyticsmessage true ==> Tapping openresty/brew Cloning into ‘/usr/local/Homebrew/Library/Taps/openresty/homebrew-brew‘... remote: Counting objects: 72, done. remote: Compressing objects: 100% (72/72), done. remote: Total 72 (delta 1), reused 44 (delta 0), pack-reused 0 Unpacking objects: 100% (72/72), done. Tapped 62 formulae (162 files, 131.7KB) ==> Installing openresty from openresty/brew Error: The following formula: openresty cannot be installed as a binary package and must be built from source. Install the Command Line Tools: xcode-select --install Sonofelice:bch-flowrouter baidu$ brew untap homebrew/nginx Error: No available tap homebrew/nginx. Sonofelice:bch-flowrouter baidu$ xcode-select --install xcode-select: note: install requested for command line developer tools
我遇到上面的错误,主要是因为缺少xcode-select
xcode-select --install
会弹出插件安装框,安装好之后再执行
brew install openresty/brew/openresty
进行安装即可。
安装完成后,启动openresty,命令行直接输入openresty即可。可能会看到如下错误:
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
这是因为非root用户没有启动权限。使用sudo openresty启动即可。
在浏览器输入:http://127.0.0.1/
看到如下页面则表示openresty启动成功