xcode 无法安装自制软件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/49268004/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:35:07  来源:igfitidea点击:

Can't install homebrew

rubyxcodecurlterminalhomebrew

提问by user3089840

I have a fairly new macbook pro and I'm simply trying to install homebrew according to the directions on their site:

我有一个相当新的 macbook pro,我只是想根据他们网站上的说明安装自制软件:

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

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

However, when I run this I get the following output:

但是,当我运行它时,我得到以下输出:

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

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

My macbook only has 1 user, which is me, the Administrator. That's who I'm logged in as on the computer.

我的 macbook 只有 1 个用户,也就是我,管理员。那就是我在计算机上登录的人。

Another thing I've tried is running the command with sudo, in which case I get the following message:

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

Don't run this as root!

Don't run this as root!

Another thing I've tried is downloading Command Line Tools (CLT) for Xcode: xcode-select --installas I saw this suggested on Homebrew's site and elsewhere online.

我尝试过的另一件事是下载,Command Line Tools (CLT) for Xcode: xcode-select --install因为我在 Homebrew 的网站和在线其他地方看到了这个建议。

After creating a new user with "Admin" privileges apart from my root account, the homebrew install command above started to run but then quit with the following error:

除了我的 root 帐户之外,创建一个具有“管理员”权限的新用户后,上面的 homebrew install 命令开始运行,但随后退出并出现以下错误:

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

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

At this point I'm stuck and not sure what to do.

在这一点上,我被卡住了,不知道该怎么做。

回答by user3089840

I was able to install Homebrew using the following steps. Note I did this on a non-root admin user account. I had to create this user account separately and give it admin access just to do this. Once I logged out of my root account and logged into the admin non-root account, I typed the following commands into terminal:

我能够使用以下步骤安装 Homebrew。请注意,我是在非 root 管理员用户帐户上执行此操作的。我必须单独创建此用户帐户并为其授予管理员访问权限才能执行此操作。一旦我注销了我的 root 帐户并登录到 admin 非 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

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

I found most of these steps here:

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

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

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

Hope this helps someone else.

希望这对其他人有帮助。

回答by Daniel Lara

Have you tried installing Xcode first?

您是否尝试过先安装 Xcode?

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

Then see if the installation was correct with "brew doctor"

然后用“brew doctor”查看安装是否正确

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

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

回答by Steven Aguilar

Uninstall and reinstall reinstall Homebrew. Run sudo chown -R $USER /usr/localand then reinstall

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