mac port 更新报错:Error installing new MacPorts base: command execution failed

作者:袖梨 2022-06-30

核心提示:

回想你是不是更新过xcode,而且更新过后,还没有使用过。如果是,请同意一下命令行版的用户协议,终端里运行

sudo xcodebuild -license然后按提示输入 agree,完了重试port更新。

如果不是这样,那请转到google搜索,并啃英文资料吧。

其实只需要看到这里就够了,下面是发现这一点的过程,可以认为是废话,不推荐继续阅读;读了也不多,多花费一点时间而已。


mac port 用了一段时间,需要更新,但是出错了,如下:

sh-3.2# port selfupdate
--->  Updating MacPorts base sources using rsync
MacPorts base version 2.3.3 installed,
MacPorts base version 2.3.4 downloaded.
--->  Updating the ports tree
--->  MacPorts base is outdated, installing new version 2.3.4
Installing new MacPorts release in /opt/local as root:admin; permissions 0755

Error: Error installing new MacPorts base: command execution failed
Please run `port -v selfupdate' for details.
Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: command execution failed那就按提示,带-v参数,看详细信息

sh-3.2# port -v selfupdate
checking Mac OS X version... 10.10.5
checking Xcode location... /Applications/Xcode.app/Contents/Developer
checking Xcode version... 7.1.1
checking whether the C compiler works... no
configure: error: in `/opt/local/var/macports/sources/sea.us.rsync.macports.org/release/tarballs/base':
configure: error: C compiler cannot create executables
See `config.log' for more details
Command failed: cd /opt/local/var/macports/sources/sea.us.rsync.macports.org/release/tarballs/base && CC=/usr/bin/cc OBJC=/usr/bin/cc ./configure --prefix=/opt/local --with-install-user=root --with-install-group=admin --with-directory-mode=0755 --enable-readline && make SELFUPDATING=1 && make install SELFUPDATING=1
Exit code: 77
Error: Error installing new MacPorts base: command execution failed
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: command execution failed看上面消息里的 Command failed 一行,原始命令竟然是 cc 报错,新打开一个终端页,运行cc,果然是不正常的,如下

fsmac:~ feng$ cc


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


fsmac:~ feng$ cc -v


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


fsmac:~ feng$ cc --version


Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.没有仔细看,google了一下前面错误消息,国外社区里有相关帖子http://stackoverflow.com/questions/19622337/cant-update-macports-with-mac-os-x-mavericks ,说

Install the "Command Line Tools" first
sudo xcode-select --install这货之前确实安装过,又往下看,有说

There might be a chance that you haven’t agreed with the XCode license. If xcode-install doesn’t help, you can run the belowing command to agree with Xcode license. sudo xcodebuild -license

回想一下,果然,前几天安应用商店里更新了xcode,这货更新了,但还得再次确认一下同意协议,苹果真够??碌?/p>

fsmac:~ feng$ sudo xcodebuild -license


You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.

Hit the Enter key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'

Apple Inc.

Xcode and Apple SDKs Agreement
......
By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel]

agree后,再运行,正常的了

fsmac:~ feng$ cc
clang: error: no input files
fsmac:~ feng$ cc --version
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

相关文章

精彩推荐