mac brew 安装nginx踩坑纪录

使用brew 安装报错

.tar.gz
==> Installing dependencies for nginx: pcre
==> Installing nginx dependency: pcre
==> Pouring pcre-8.45.catalina.bottle.tar.gz
tar: Error opening archive: Failed to open '/Users/lin/Library/Caches/Homebrew/downloads/ce4601790d01efbc93945be3baacdf988cd709d230d9bc4c195f68831fde7434--pcre-8.45.catalina.bottle.tar.gz'
Error: Failure while executing; `tar --extract --no-same-owner --file /Users/lin/Library/Caches/Homebrew/downloads/ce4601790d01efbc93945be3baacdf988cd709d230d9bc4c195f68831fde7434--pcre-8.45.catalina.bottle.tar.gz --directory /private/tmp/d20210624-76197-i4mh4y` exited with 1. Here's the output:
tar: Error opening archive: Failed to open '/Users/lin/Library/Caches/Homebrew/downloads/ce4601790d01efbc93945be3baacdf988cd709d230d9bc4c195f68831fde7434--pcre-8.45.catalina.bottle.tar.gz'
image.png

解决方案

  • 手动安装 pcre
brew install pcre
image.png

再次安装nginx

 brew install nginx
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles/ng
==> Downloading from https://homebrew.bintray.com/bottles/nginx-1.21.0.catalina.
#=#=-#  #                                                                     
curl: (22) The requested URL returned error: 403 Forbidden
Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/nginx/manifests/1.21.0
Already downloaded: /Users/lin/Library/Caches/Homebrew/downloads/3b5137332fce6303650d3f58bda7cda5c7576a302180d8cf2e2c70b81284cdc8--nginx-1.21.0.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/nginx/blobs/sha256:03f0a7380a44
Already downloaded: /Users/lin/Library/Caches/Homebrew/downloads/455cb2806ba04ff17fb66be359babc9c6fb44626dd2535e546d27e8af71566ff--nginx--1.21.0.catalina.bottle.tar.gz
==> Pouring nginx--1.21.0.catalina.bottle.tar.gz
==> Caveats
Docroot is: /usr/local/var/www

The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.

nginx will load all files in /usr/local/etc/nginx/servers/.

To have launchd start nginx now and restart at login:
  brew services start nginx
Or, if you don't want/need a background service you can just run:
  nginx
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容