読者です 読者をやめる 読者になる 読者になる

Mac miniにgitをインストール

昨日のOSCの復習のためにMacにgitをインストールしてみた。
MacPortsを使ったけどちょっとはまったのでログを残しとく。

失敗編

まずは普通にインストールを試す。

$ sudo port install cogito
--->  Activating p5-scalar-list-utils @1.19_1
Error: Target org.macports.activate returned: Image error: /opt/local/lib/perl5/5.8.9/darwin-2level/auto/List/Util/Util.bs is being used by the active perl5.8 port.  Please deactivate this port first, or use the -f flag to force the activation.
Error: The following dependencies failed to build: git-core p5-scalar-list-utils rsync popt
Error: Status 1 encountered during processing.

perl5.8をdeactivateしろと言ってるっぽいのでやってみる。

$ sudo port deactivate perl5.8
--->  Deactivating perl5.8
$ sudo port install cogito
--->  Activating perl5.8 @5.8.9_1
--->  Cleaning perl5.8
--->  Activating p5-scalar-list-utils @1.19_1
Error: Target org.macports.activate returned: Image error: /opt/local/lib/perl5/5.8.9/darwin-2level/auto/List/Util/Util.bs is being used by the active perl5.8 port.  Please deactivate this port first, or use the -f flag to force the activation.
Error: The following dependencies failed to build: git-core p5-scalar-list-utils rsync popt
Error: Status 1 encountered during processing.

最初に勝手にactivateされちゃってまた同じエラーに。

perl5.8をアンインストールしてみる。

$ sudo port uninstall -f perl5.8
--->  Unable to uninstall perl5.8 5.8.9_1, the following ports depend on it:
--->  	perl5
Warning: Uninstall forced.  Proceeding despite dependencies.
--->  Deactivating perl5.8 @5.8.9_1
--->  Uninstalling perl5.8 @5.8.9_1

再度gitをインストール。

$ sudo port install cogito
--->  Activating p5-scalar-list-utils @1.19_1
--->  Cleaning p5-scalar-list-utils
--->  Fetching popt
--->  Attempting to fetch popt-1.14.tar.gz from http://distfiles.macports.org/popt
--->  Verifying checksum(s) for popt
--->  Extracting popt
--->  Configuring popt
--->  Building popt
--->  Staging popt into destroot
--->  Installing popt @1.14_0
--->  Activating popt @1.14_0
--->  Cleaning popt
--->  Fetching rsync
--->  Attempting to fetch rsync-3.0.5.tar.gz from http://distfiles.macports.org/rsync
--->  Verifying checksum(s) for rsync
--->  Extracting rsync
--->  Applying patches to rsync
--->  Configuring rsync
--->  Building rsync
--->  Staging rsync into destroot
--->  Installing rsync @3.0.5_0
--->  Activating rsync @3.0.5_0
--->  Cleaning rsync
--->  Fetching git-core
--->  Attempting to fetch git-1.6.1.tar.bz2 from http://distfiles.macports.org/git-core
--->  Attempting to fetch git-manpages-1.6.1.tar.bz2 from http://distfiles.macports.org/git-core
--->  Attempting to fetch git-htmldocs-1.6.1.tar.bz2 from http://distfiles.macports.org/git-core
--->  Verifying checksum(s) for git-core
--->  Extracting git-core
--->  Applying patches to git-core
--->  Configuring git-core
--->  Building git-core
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_git-core/work/git-1.6.1" && make all CFLAGS="-Wall -O2 -I/opt/local/include" LDFLAGS="-L/opt/local/lib" prefix=/opt/local CURLDIR=/opt/local OPENSSLDIR=/opt/local ICONVDIR=/opt/local PERL_PATH="/opt/local/bin/perl" NO_FINK=1 NO_DARWIN_PORTS=1 NO_R_TO_GCC_LINKER=1 " returned error 2
Command output:     CC http-push.o
    LINK git-http-push
    CC daemon.o
    LINK git-daemon
    CC imap-send.o
    LINK git-imap-send
    GEN git-am
    GEN git-bisect
    GEN git-filter-branch
    GEN git-lost-found
    GEN git-merge-octopus
    GEN git-merge-one-file
    GEN git-merge-resolve
    GEN git-mergetool
    GEN git-parse-remote
    GEN git-pull
    GEN git-quiltimport
    GEN git-rebase--interactive
    GEN git-rebase
    GEN git-repack
    GEN git-request-pull
    GEN git-sh-setup
    GEN git-stash
    GEN git-submodule
    GEN git-web--browse
    SUBDIR perl
/opt/local/bin/perl Makefile.PL PREFIX='/opt/local'
make[1]: /opt/local/bin/perl: Command not found
make[1]: *** [perl.mak] Error 127
make: *** [perl/perl.mak] Error 2

Error: The following dependencies failed to build: git-core
Error: Status 1 encountered during processing.

最初よりは進んだけどまたエラーが出た。"make[1]: /opt/local/bin/perl: Command not found"perlコマンドが無いせいらしい。うん、さっき消した。
仕方ないのでperl5.8を再インストール

$ sudo port install perl5.8
--->  Fetching perl5.8
--->  Verifying checksum(s) for perl5.8
--->  Extracting perl5.8
--->  Configuring perl5.8
--->  Building perl5.8
--->  Staging perl5.8 into destroot
--->  Installing perl5.8 @5.8.9_1
--->  Activating perl5.8 @5.8.9_1
Error: Target org.macports.activate returned: Image error: /opt/local/lib/perl5/5.8.9/darwin-2level/auto/List/Util/Util.bs is being used by the active p5-scalar-list-utils port.  Please deactivate this port first, or use the -f flag to force the activation.
Error: Status 1 encountered during processing.

またエラー。今度はp5-scalar-list-utilsをdeactivate。

$ sudo port deactivate p5-scalar-list-utils
--->  Deactivating p5-scalar-list-utils
$ sudo port install perl5.8
--->  Activating perl5.8 @5.8.9_1
--->  Cleaning perl5.8
$ sudo port install cogito
--->  Activating p5-scalar-list-utils @1.19_1
Error: Target org.macports.activate returned: Image error: /opt/local/lib/perl5/5.8.9/darwin-2level/auto/List/Util/Util.bs is being used by the active perl5.8 port.  Please deactivate this port first, or use the -f flag to force the activation.
Error: The following dependencies failed to build: git-core p5-scalar-list-utils
Error: Status 1 encountered during processing.

振り出しに戻る。さっきcogitoのインストールが少し進んだので未インストールのパッケージはあと2つになってるけど。
ということで多分次からの手順だけでうまくいくはず。

成功編

さらに解決法を調べて以下の記事を発見。試してみる。
http://d.hatena.ne.jp/tenkoma/20090111/1231697110

$ sudo port -f uninstall p5-scalar-list-utils
--->  Uninstalling p5-scalar-list-utils @1.19_1
$ sudo port clean p5-scalar-list-utils
--->  Cleaning p5-scalar-list-utils
$ sudo port -f install p5-scalar-list-utils
--->  Fetching p5-scalar-list-utils
--->  Verifying checksum(s) for p5-scalar-list-utils
--->  Extracting p5-scalar-list-utils
--->  Configuring p5-scalar-list-utils
--->  Building p5-scalar-list-utils
--->  Staging p5-scalar-list-utils into destroot
You must install or activate this package with '-f' (force) as it needs to overwrite files installed by the perl5.8 port
--->  Installing p5-scalar-list-utils @1.19_1
--->  Activating p5-scalar-list-utils @1.19_1
Warning: File /opt/local/lib/perl5/5.8.9/darwin-2level/auto/List/Util/Util.bs already exists.  Moving to: /opt/local/lib/perl5/5.8.9/darwin-2level/auto/List/Util/Util.bs.mp_1245560009.
Warning: File /opt/local/lib/perl5/5.8.9/darwin-2level/auto/List/Util/Util.bundle already exists.  Moving to: /opt/local/lib/perl5/5.8.9/darwin-2level/auto/List/Util/Util.bundle.mp_1245560009.
Warning: File /opt/local/lib/perl5/5.8.9/darwin-2level/List/Util.pm already exists.  Moving to: /opt/local/lib/perl5/5.8.9/darwin-2level/List/Util.pm.mp_1245560009.
Warning: File /opt/local/lib/perl5/5.8.9/darwin-2level/Scalar/Util.pm already exists.  Moving to: /opt/local/lib/perl5/5.8.9/darwin-2level/Scalar/Util.pm.mp_1245560009.
Warning: File /opt/local/share/man/man3/List::Util.3pm.gz already exists.  Moving to: /opt/local/share/man/man3/List::Util.3pm.gz.mp_1245560009.
Warning: File /opt/local/share/man/man3/Scalar::Util.3pm.gz already exists.  Moving to: /opt/local/share/man/man3/Scalar::Util.3pm.gz.mp_1245560009.
--->  Cleaning p5-scalar-list-utils
$ sudo port install cogito
--->  Building git-core
--->  Staging git-core into destroot
--->  Installing git-core @1.6.1_1+doc
--->  Activating git-core @1.6.1_1+doc
--->  Cleaning git-core
--->  Fetching cogito
--->  Attempting to fetch cogito-0.18.2.tar.bz2 from http://distfiles.macports.org/cogito
--->  Verifying checksum(s) for cogito
--->  Extracting cogito
--->  Applying patches to cogito
--->  Configuring cogito
--->  Building cogito
--->  Staging cogito into destroot
--->  Installing cogito @0.18.2_1
--->  Activating cogito @0.18.2_1
--->  Cleaning cogito

なんか途中で警告は出てるけどとりあえずうまくいったっぽい。
だいぶ回り道してしまった。