ksaitoの日記

日々試したことの覚え書き

MacPortsのselfupdateが失敗

移転しました。

自動的にリダイレクトします。

久しぶりにMacPortsのアップグレードをしたら失敗しました。
原因は、コンパイラがインストールされていなかったからでした。
XcodeをインストールしてCommand Line Toolsをダウンロードする必要がありあすが、Xcodeをバージョンアップした時に削除されてしまったようです。
Command Line Toolsをインストールしたら解決しました。

現象

MacPorts全般でエラーになる。

$ sudo port -d selfupdate
...中略...
checking for gcc... /usr/bin/llvm-gcc-4.2
checking whether the C compiler works... no
configure: error: in `/opt/local/var/macports/sources/rsync.macports.org/release/base':
configure: error: C compiler cannot create executables
See `config.log' for more details
shell command "cd /opt/local/var/macports/sources/rsync.macports.org/release/base && CC=/usr/bin/llvm-gcc-4.2 ./configure --prefix=/opt/local --with-tclpackage=/Library/Tcl --with-install-user=root --with-install-group=admin --with-directory-mode=0755 --enable-readline && make && make install" returned error 77
DEBUG: Error installing new MacPorts base: shell command failed (see log for details)
    while executing
"macports::selfupdate [array get global_options] base_updated"
Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: shell command failed (see log for details)

よく見ると下記のメッセージで/usr/bin/llvm-gcc-4.2がない事がわかります。

checking for gcc... /usr/bin/llvm-gcc-4.2
checking whether the C compiler works... no

確認してみると確かにありません。

$ ls /usr/bin/llvm-gcc-4.2
ls: /usr/bin/llvm-gcc-4.2: No such file or directory
$

コンパイラのインストール

Xcodeを起動してXcodeーPreferencesを開きます。
Downloadsを選択してCommand Line Toolsをダウンロードします。

アップデート成功

うまくいきました。

$ sudo port selfupdate
Password:
--->  Updating the ports tree
--->  Updating MacPorts base sources using rsync
MacPorts base version 1.9.2 installed,
MacPorts base version 2.1.2 downloaded.
--->  MacPorts base is outdated, installing new version 2.1.2
Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl


The ports tree has been updated. To upgrade your installed ports, you should run
  port upgrade outdated
$