MacPortsのselfupdateがエラーになる件(MacOS X 10.7.5 Lion)
MacPortsを久しぶりに動かそうとしたら古いって言われたのでupdateしようとした。がエラー。
$ sudo port install xz Password: Warning: port definitions are more than two weeks old, consider using selfupdate Error: Insufficient privileges to write to MacPorts install prefix. $ sudo port selfupdate Password: ---> Updating MacPorts base sources using rsync MacPorts base version 2.1.3 installed, MacPorts base version 2.3.3 downloaded. ---> Updating the ports tree ---> MacPorts base is outdated, installing new version 2.3.3 Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: command execution failed $
こちらのサイトによると、Xcodeのコマンドラインツールが必要とのことで実行してみたが、--installなんてオプションがないのでインストールできない。
$ sudo xcode-select --install Usage: xcode-select -print-path or: xcode-select -switch <xcode_folder_path> or: xcode-select -version Arguments: -print-path Prints the path of the current Xcode folder -switch <xcode_folder_path> Sets the path for the current Xcode folder -version Prints xcode-select version information $ xcode-select -version xcode-select version 2308. $
どうもこのバージョンには--installなんてオプションがないらしい(OSが古いから?)。
Xcodeを起動し[Xcode] -> [Open Developer Tool] -> [More Developer Tools…] を開いてDeveloperネットワークに接続して
をダウンロード。ちなみにXcode自体は4.6.2になっている。なのでコマンドラインツールをインストールしてなかったということ。
ダウンロードしたファイル
xcode462_cltools_10_76938260a.dmg
をクリックしてマウントし、表示された
Command Line Tools(Lion).mpkg
を起動してインストールする。インストール画面に「インストールが完了しました。」が出たら終了。
その後、selfupdateしてみた。ちなみにxcode-selectがバージョンアップされるわけではない。
$ xcode-select -version xcode-select version 2308. $ sudo port selfupdate Password: ---> Updating MacPorts base sources using rsync MacPorts base version 2.1.3 installed, MacPorts base version 2.3.3 downloaded. ---> Updating the ports tree ---> MacPorts base is outdated, installing new version 2.3.3 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
メッセージのとおり、ついでに portでインストールしたものもupgradeを実行した。
$ sudo port upgrade outdated Password: …… $
でインストールしたかったxzなんだけど、upgradeしたら入っていたみたい。
$ which xz /opt/local/bin/xz $ ls -l /opt/local/bin/xz -rwxr-xr-x 1 root admin 75384 3 9 16:41 /opt/local/bin/xz $ which unxz /opt/local/bin/unxz $ ls -l /opt/local/bin/unxz lrwxr-xr-x 1 root admin 2 3 9 16:41 /opt/local/bin/unxz -> xz $
結局は、OSが古い(といってももうバージョンアップできないから仕方ない)のでMacPortsのアップデートに必要なXcodeコマンドラインツールをxcode-select --installでインストールできずにハマったというオチ。
参考サイトは以下。
http://t-horikiri.hatenablog.jp/entry/20131031/1383202003
http://little-braver.com/450/