zoukankan      html  css  js  c++  java
  • [转]Homebrew 卸载时出现:Failed to locate Homebrew! 错误

    今天在 MacBook 上安装 Homebrew,结果中间断了网,想重新卸载重装,结果一直卸载失败。问题现象如下:

    问题现象

    卸载时错误如下:

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
    Failed to locate Homebrew!

    重装时错误如下:

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    It appears Homebrew is already installed. If your intent is to reinstall you
    should do the following before running this installer again:
        ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
    The current contents of /usr/local are bin Cellar etc Frameworks Homebrew include lib opt sbin share var

    问题分析

    google 后发现有这样的问题讨论帖子,有人建议执行:

    rm -rf /usr/local/.git

    后再重新安装。貌似这个解决方案有很多人成功了。不过我这么做后还是出现卸载失败。

    粗粗想了一下,大概因为是断网造成的,断网导致了安装不完全,在安装目录产生了一些不完整的目录文件。
    查找了一下,找到一个目录
    执行:

    mdfind homebrew

    找到:

    /usr/local/Homebrew

    cd 到/usr/local/目录,ls -al 了一下,发现还存在几个安装时出现过的目录名字,于是一并删除了。

    下面是当初安装时的提示信息:

    local ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    ==> This script will install:
    /usr/local/bin/brew
    /usr/local/share/doc/homebrew
    /usr/local/share/man/man1/brew.1
    /usr/local/share/zsh/site-functions/_brew
    /usr/local/etc/bash_completion.d/brew
    /usr/local/Homebrew
    ==> The following new directories will be created:
    /usr/local/Cellar
    /usr/local/Homebrew
    /usr/local/Frameworks
    
    Press RETURN to continue or any other key to abort

    下面是 ls -al 的信息:

    local ls -al
    total 0
    drwxr-xr-x  13 Ade   wheel  442  9 12 19:15 .
    drwxr-xr-x@ 12 root  wheel  408 12  5  2015 ..
    drwxrwxr-x   2 Ade   admin   68  9 12 19:15 Cellar
    drwxrwxr-x   2 Ade   admin   68  9 12 19:15 Frameworks
    drwxrwxr-x   3 Ade   admin  102  9 12 19:15 Homebrew

    问题解决

    删除 Homebrew 安装时产生的目录

    rm -rf Cellar Frameworks Homebrew

    重新执行安装命令:

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    按照提示 回车 继续执行,
    最后出现下面的提示表示安装成功

    ==> Installation successful!
    ==> Next steps
    Run `brew help` to get started
    Further documentation: https://git.io/brew-docs
    ==> Homebrew has enabled anonymous aggregate user behaviour analytics
    Read the analytics documentation (and how to opt-out) here:
      https://git.io/brew-analytics

    执行 brew help,正常显示命令帮助,Nice !

  • 相关阅读:
    Hibernate映射之数组属性, 集合属性(list、set和map)
    org.hibernate.type.SerializationException: could not deserialize 反序列化失败
    linux下同一个tomcat部署多个项目
    Nexus私服 Maven
    maven 父子项目 聚合与继承 生命周期 打包插件 依赖打包 jar pom war
    IDEA中创建Web聚合项目(Maven多模块项目)
    为什么要在linux命令前加上 ./ 什么时候才需要在命令前加上./
    web.xml 介绍 and pom.xml 介绍
    有趣的linux命令
    SpringMVC 中常见注释
  • 原文地址:https://www.cnblogs.com/wdsunny/p/5879883.html
Copyright © 2011-2022 走看看