Mountain Lion にしたときにどうするかというお話です。
#pre{{
$ sudo port selfupdate
...
---> Updating MacPorts base sources using rsync
MacPorts base version 2.1.1 installed,
MacPorts base version 2.1.2 downloaded.
---> Updating the ports tree
---> 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
Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: command execution failed
}}
* Xcode Command Line Tool のインストール [#b13f0c1d]
[[Downloads for Apple Developers:https://developer.apple.com/downloads/index.action]] からダウンロードしてインストールします。
クリックしていけば終わりです。
&ref("CommandLineTool.png",, 50%);
* selfupdate [#k1c8db5e]
今度は selfupdate も正しく終わります。
#pre{{
---> Updating MacPorts base sources using rsync
MacPorts base version 2.1.1 installed,
MacPorts base version 2.1.2 downloaded.
---> Updating the ports tree
---> 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
}}
* upgrade中に起こるさまざまな出来事と対処 [#xbac6033]
port upgrade outdated すると、全部入れ直しになります。
#pre{{
Warning: Deactivate forced. Proceeding despite dependencies.
}}
これが毎回出ますが気にせず進めます。
途中で Java を入れたりもします。自動でインストーラが起動します。
&ref("JavaForOSX2012-004.png");
zlib ではこのように怒られたりしました。
#pre{{
---> Extracting zlib
Error: Couldn't determine your Xcode version (from '/usr/bin/xcodebuild -version').
Error:
Error: If you have not installed Xcode, install it now; see:
Error: http://guide.macports.org/chunked/installing.xcode.html
Error:
Error: org.macports.extract for port zlib returned: unable to find Xcode
Error: Failed to install zlib
Please see the log file for port zlib for details:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_zlib/zlib/main.log
Error: The following dependencies were not installed: zlib
Error: Unable to upgrade port: 1
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets
}}
xcodebuild -version してみろということで。
#pre{{
$ xcodebuild -version
xcode-select: Error: No Xcode is selected. Use xcode-select -switch <path-to-xcode>, or see the xcode-select manpage (man xcode-select) for further information.
}}
エラーですか。
Command Line Tools だけでは /Application/Xcode.app がないので、
Xcode もインストールする必要があるようです。
これもダウンロードしてインストールします。
最初に System Component Installation ということで
1つ何かインストールすることになります。
&ref("SystemComponentInstallation.png",,50%);
dmg をクリックしてインストールするんだろうと思いきや、
これはアプリケーションにコピーする形らしいです。
&ref("Xcode.png");
Xcode を入れたら path を指定します。
#pre{{
$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
}}
ライセンスにも合意しなければいけないようです。最後に agree と入れます。
#pre{{
$ sudo xcodebuild -license
}}
正しく入っていれば、xcodebuild がエラーなく返ってきます。
#pre{{
$ xcodebuild -version
Xcode 4.4
Build version 4F250
}}
これで先ほど引っかかった zlib も通りました。
基本的にはこれで全部通るはずです。
#pre{{
$ sudo port upgrade outdated
...
---> Updating database of binaries: 100.0%
---> Scanning binaries for linking errors: 100.0%
---> No broken files found.
}}
* 掃除 [#l9915a5e]
Mountain Lion とは関係ないですが、MacPorts はアプリが更新されてもそのまま古いものが残ります。
まず使わないと思いますので、定期的に削除しましょう。
#pre{{
$ sudo port -u -f uninstall
$ sudo port clean -f --all installed
}}
* X 関係 [#uf13ccca]
X11.app は Mountain Lion から配布されなくなったそうで、
[[XQuartz:http://xquartz.macosforge.org/landing/]] をインストールする必要があります。
X を使うアプリを MacPorts から入れているときは要注意。