mac下安装nginx

安装命令:$ brew install nginx

安装时报如下错误:

Updating Homebrew...
error: Not a valid ref: refs/remotes/origin/master
Error: No available formula with the name "nginx"
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.

修复Homebrew

修改清华源命令:

cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.gitcd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

执行以上命令,继续报错:

$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

据查以上报错是git运行需要一个xcode插件,执行以下命令:

xcode-select --install

等待1~2min后,插件安装完成,重新执行修改源为清华源的命令,无报错。

执行brew update

执行brew update命令,报错:

$ brew update
error: Not a valid ref: refs/remotes/origin/master
fatal: Could not resolve HEAD to a revision
Already up-to-date.

查找以上error解决方法,执行brew update --verbose,结果如下:

$ brew update --verbose
Checking if we need to fetch /usr/local/Homebrew...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
Fetching /usr/local/Homebrew...
Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
Updating /usr/local/Homebrew...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Switched to and reset branch 'master'
Your branch is up to date with 'origin/master'.
Switched to and reset branch 'stable'
Current branch stable is up to date.Updating /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
fatal: Could not resolve HEAD to a revisionAlready up-to-date.

更加以上报错,可知报错路径为: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core

打开该路径:

cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
$ ls -al
total 0
drwxr-xr-x   3 zuige  admin   96  7 11 00:21 .
drwxr-xr-x   3 zuige  admin   96  7 11 02:15 ..
drwxr-xr-x  12 zuige  admin  384  7 18 01:03 .git

发现只有一个.git文件
在该路径下执行:

$ git fetch --prune origin
$ git pull --rebase origin master
From https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core* branch                  master     -> FETCH_HEAD
Updating files: 100% (5370/5370), done.

再次执行brew update,更新成功。

$ brew update
Already up-to-date.

安装nginx

再次执行安装nginx命令,安装成功。

$ brew install nginx

mac下使用Homebrew安装nginx报错相关推荐

  1. MongoDB学习第一篇 --- Mac下使用HomeBrew安装MongoDB

    2019独角兽企业重金招聘Python工程师标准>>> MongoDB学习第一篇 --- Mac下使用HomeBrew安装MongoDB 0.确保mac已经安装了HomeBrew ( ...

  2. 关于MAC下pymysql连接mysql数据库报错2003的问题解决方法

    关于MAC下pymysql连接mysql数据库报错2003的问题解决方法 问题:pymysql.err.OperationalError: (2003, "Can't connect to ...

  3. phpstudy环境下laravel项目,Nginx报错CreateFile failed

    phpstudy nginx环境,nginx报错日志如下: 2020/04/13 15:40:33 [error] 7844#14252: *7 CreateFile() "D:/phpst ...

  4. MAC:使用homebrew安装nginx

    前提:成功安装homebrew 1.打开终端输入 brew install nginx 如果报以下错误: 解决方案: fatal: not in a git directory Error: Comm ...

  5. mac系统升级后npm安装依赖报错gyp: No Xcode or CLT version detected

    mac更新系统后,npm安装依赖包报错如下: gyp: No Xcode or CLT version detected 原因: 缺少了XCODE的CLI(command-line tools )工具 ...

  6. Mac 下用Homebrew安装Go

    终极安装brew 方法 /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.s ...

  7. docker安装nginx 报错 no matching manifest for windows/amd64 10.0.18363 in the manifest list entries

    报错信息如图 解决方案:打开docker desktop 设置,将"experimental"的值由false改为true,应用重启 重新拉取docker pull nginx:l ...

  8. Mac下通过homebrew安装maven

    1.安装Homebrew 将以下命令粘贴至终端 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebr ...

  9. window10安装python2.7_window10下python2.7安装pip报错

    get-pip.py 文件内容来源于(将网页内容保存) https://bootstrap.pypa.io/get-pip.py 报错信息 D:\softs\python\Python27>py ...

最新文章

  1. word中用EndNote引用文献,之后再打开插入新文献,格式显示错误的问题
  2. Revit二次开发之“使用ElementTransformUtils.MoveElement()移动元素”
  3. 浏览器阻止window.open的解决方案
  4. c#输入三个数选出最大的_C#习题,3、 输入三个数字,输出他们的最大值。(if) | 学步园...
  5. 3种双集群系统方案设计模式详解
  6. java bit mask_位掩码(Bit Mask)的应用
  7. PCL中把点云拟合成曲面(附源代码)
  8. JAVA程序将PDF转化为TXT
  9. 用“文通慧视”识别屏幕或图片中的文字
  10. ActiveX开发详解
  11. 离线强化学习(Offline RL)系列3: (算法篇) TD3+BC 算法详解与实现(经验篇)
  12. 信用卡诈骗新招式:谎称银行来电帮提升额度
  13. 什么是服务器、云服务的优缺点是什么、为什么要使用云服务器?
  14. SparkStreaming动态读取配置文件
  15. “0基础考生考前三小时突破《申论》80分气哭学霸”——公文题(公文基础理论+方案类+总结类)
  16. Oracle Executable Binary Mismatch Detected
  17. 安利三个好用视频配音乐的软件
  18. PS|002自制夸张表情包
  19. idea创建SSM项目(Spring+SpringMVC+MyBatis)
  20. mac电脑安装flink其他版本(历史版本)简单有效

热门文章

  1. Pandas学习(三)---数值运算
  2. 第18课 Altium Designer20(AD20)+VESC6.4实战教程:DRV8301布局及注意事项(北冥有鱼)
  3. 目标检测~无人机视角
  4. 视频教程-程序员的数学:微积分-Python
  5. metalink登陆故障解决!
  6. PHP 全局变量global与$GLOBAL大详解
  7. 桌面任务栏卡死了解决办法
  8. 简单、彻底的解决 iOS 5.0.1 完美越狱 iBooks 秒退问题
  9. 基于SSE指令集的程序设计简介
  10. 华硕X550VC(Qualcomm Atheros AR9485 无线网卡)解决在ubuntu14.04/15.04下无线网卡不能链接无线网问题