代码之家  ›  专栏  ›  技术社区  ›  Bryan Miller

无法安装自制软件

  •  6
  • Bryan Miller  · 技术社区  · 7 年前

    我有一台全新的macbook pro,我只是想按照他们网站上的说明安装自制软件:

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

    但是,当我运行此命令时,我会得到以下输出:

    The user \u cannot be found There was an unknown error. This script requires the user \u to be an Administrator.

    我的macbook只有一个用户,即我,管理员。这就是我在电脑上登录的人。

    我尝试过的另一件事是使用 sudo ,在这种情况下,我会收到以下消息:

    Don't run this as root!

    我试过的另一件事是下载 Command Line Tools (CLT) for Xcode: xcode-select --install 正如我在自制网站和其他在线网站上看到的那样。

    在创建了除我的根帐户外具有“Admin”权限的新用户后,上面的homebrew安装命令开始运行,但随后退出,出现以下错误:

    /usr/local/homebrew/.git: Permission denied Failed during: git init -q

    在这一点上,我陷入了困境,不知道该怎么办。

    3 回复  |  直到 7 年前
        1
  •  11
  •   Bryan Miller    7 年前

    我可以使用以下步骤安装自制软件。注意,我是在非root管理员用户帐户上执行此操作的。我必须单独创建这个用户帐户,并授予它管理员权限才能做到这一点。一旦我注销了我的根帐户并登录到管理员非根帐户,我就在终端中键入以下命令:

    xcode-select --install cd /usr/local/Homebrew git init git remote add origin https://github.com/Homebrew/brew git fetch --all git checkout -B master origin/master cd /usr/local ln -s /usr/local/Homebrew/bin/brew /usr/local/bin

    我在这里找到了大部分步骤:

    https://github.com/Homebrew/homebrew-core/issues/5084#issuecomment-248834806

    希望这对其他人有帮助。

        2
  •  0
  •   Daniel Lara    7 年前

    您是否尝试过先安装Xcode?

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

    然后使用“brew医生”查看安装是否正确

    资料来源: https://www.howtogeek.com/211541/homebrew-for-os-x-easily-installs-desktop-apps-and-terminal-utilities/

        3
  •  0
  •   Steven Aguilar    7 年前

    卸载并重新安装重新安装Homebrew。 跑 sudo chown -R $USER /usr/local 然后重新安装