“同意 Xcode/iOS 许可证需要管理员权限,请通过 sudo 以 root 身份重新运行。” 使用 GCC 时

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26197347/
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-08-31 03:01:09  来源:igfitidea点击:

"Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo." when using GCC

iosxcodegcc

提问by coachcal

While attempting to compile my C program, running the following command:

在尝试编译我的 C 程序时,运行以下命令:

gcc pthread.c -o pthread

Returns:

返回:

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

同意 Xcode/iOS 许可证需要管理员权限,请通过 sudo 以 root 身份重新运行。

and my code does not compile.

我的代码无法编译。

Why is this happening and how can I fix this problem?

为什么会发生这种情况,我该如何解决这个问题?

回答by coachcal

Open up Xcode, and accept the new user agreement. This was happening because a new version of Xcode was downloaded and the new agreement was not accepted.

打开 Xcode,并接受新的用户协议。发生这种情况是因为下载了新版本的 Xcode,但未接受新协议。

回答by Andy Barbour

sudo xcodebuild -license

will take care of it with no trouble on the command line. Note that you'll have to manually scroll through the license, and agree to its terms at the end, unless you add "accept" to the command line :

将在命令行上毫无问题地处理它。请注意,您必须手动滚动许可,并在最后同意其条款,除非您在命令行中添加“接受”:

sudo xcodebuild -license accept

回答by rahul

Got stuck as I was trying to a go get ... I think it was related to git. Here is how was able to fix it ...

被卡住了,因为我试图去获取......我认为这与git有关。这是如何修复它......

  1. I entered the following in terminal:

    sudo xcodebuild -license
    
  2. This will open the agreement. Go all the way to end and type "agree".

  1. 我在终端输入以下内容:

    sudo xcodebuild -license
    
  2. 这将打开协议。一路走到最后并输入“同意”。

That takes care of go get issues.

这可以解决 go get 问题。

It was quite interesting how unrelated things were.

非常有趣的事情是如何不相关的。

回答by Mr. Doomsbuster

Opening XCode and accepting the license fixes the issue.

打开 XCode 并接受许可证可解决此问题。

回答by codebased

You don't need to fiddle around with any command :)

你不需要摆弄任何命令:)

Once the XCode is updated, open the Xcode IDE program. Please accept terms and conditions.

更新 XCode 后,打开 Xcode IDE 程序。请接受条款和条件。

You are all set to go :))

你们都准备好了:))

回答by TaxiPixi Web Admin

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

同意 Xcode/iOS 许可证需要管理员权限,请通过sudo.

A new version of OSX or XCode was installed and Apple wants you to agree to their Terms and Conditions. So just launch Xcode and "Agree" to them.

安装了新版本的 OSX 或 XCode,Apple 希望您同意他们的条款和条件。所以只需启动 Xcode 并“同意”他们。

回答by Jabbir Basha

Follow these steps:

按着这些次序:

  1. Open Terminal.
  2. Enter this command: sudo xcodebuild --license.
  3. Enter system password.
  4. Agree to the license.
  1. 打开终端。
  2. 输入这个命令:sudo xcodebuild --license
  3. 输入系统密码。
  4. 同意许可。

回答by Benjamin

I had the same issue, after accepting the license launching XCode or running sudo xcodebuild -license accepti had to restartmy Mac – otherwise it did not worked.

我遇到了同样的问题,在接受许可证启动 XCode 或运行后,sudo xcodebuild -license accept我必须重新启动我的 Mac——否则它不起作用。

回答by Ivory Blakley

I had the same issue when I tried to use git.

当我尝试使用 git 时,我遇到了同样的问题。

It is possible to install git without it. And I doubt that gcc on mac is truly dependent on XCode. And I don't want to use root to accept something unless I'm sure I need it.

没有它也可以安装 git。而且我怀疑 mac 上的 gcc 是否真的依赖于 XCode。而且我不想使用 root 来接受某些东西,除非我确定我需要它。

I uninstalled XCode by navigating to the applications folder and dragging XCode to the trash.

我通过导航到应用程序文件夹并将 XCode 拖到垃圾箱来卸载 XCode。

Now my git commands work as usual. I'll re-install XCode if/when I truly need it.

现在我的 git 命令像往常一样工作。如果/当我真正需要它时,我会重新安装 XCode。

回答by Viplav Soni

I'm facing the same issue.

我面临同样的问题。

The issue because of X-Code.

由于 X-Code 的问题。

Solution: 1. Open X-code and accept user agreement (T&C). or 2. Restart your MAC, It will resolve automatically.

解决方案: 1. 打开 X-code 并接受用户协议(T&C)。或 2. 重新启动您的 MAC,它会自动解决。