Pages

2012年7月28日土曜日

山ライオンにハマル

OSX Mountain LionとCommand Line Toolsに関する、雑記事

Svnコマンドがない

Mauntain Lionをインストールした。 なかなか、楽しいOSなのだが、開発者にとっては、やはりOSの更新は鬼門のようだ。

開発中のソフトウエアソースの更新をしようと、svn update コマンドを実行しようとした。svnコマンドがないとエラーがでる。 ない? てっきり、MacPortsでsubversionをインストールしていたのかと勘違いしたが、実は svnコマンドは、Xcode依存だった。

StackOverFlowで既に話題

Snow Leopard以来、Xcodeをアップデートしていなかった。Lionにアップデートした時には、Xcodeが削除されることはなかったのだが、Mountain Lionでは削除されるようだ。 調べてみると、新しい Xcodeのバージョン4.4が、AppleStoreで無償で公開されている。

早速、インストール。住処は、WiMAX 1本立ちなので、2時間ほどかかってしまった。 インストール後、Xcodeを起動し、

  1. menu (Xcode) -> (Preference..) のメニューを選び、
  2. (Download)タグを選び、
  3. コンポーネント(Command Line Tools)をインストール(ボタン)する

そう、Command Line Toolsの中に、svnコマンドが入っているらしい。

MacPortsの更新に失敗する

最初に、Xcodeのインストールの前に、MacPortsを更新しようとして失敗した。 これは、やはり Xcodeの削除とともに、gccコンパイラがないためらしい。

$ sudo port selfupdate

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
--->  Updating MacPorts base sources using rsync
MacPorts base version 2.0.4 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: shell command failed (see log for details)

やはり、これも Command Line Toolsをインストールして成功。


Xcodeのインストール場所が変更になった御陰で

Xcodeのインストール場所も、 /Developer から、/Applicationsに変更されたようだ。そのため、警告が出てしまう。

developer_dirのWarning

この場合、/opt/local/etc/macports/macports.conf を少しいじる必要がある。

# 非アクティブのポートは削除します
# sudo port uninstall inactive
# 非アクティブのポートを削除した後、調べてみると、警告がでる!
$ port installed inactive
Warning: Your developer_dir setting in macports.conf points to a non-existing directory. Since this is known to cause problems, please correct the setting or comment it and let macports auto-discover the correct path.
None of the specified ports are installed.
# ----------------------------------------------
# readonlyになっているmacports.conf を修正
# (修正前)
# # Directory containing Xcode Tools
# developer_dir       /Developer
# (修正後) コメントアウトしただけ
# # Directory containing Xcode Tools
# # developer_dir       /Developer
# ----------------------------------------------
$ sudo chmod 777 /opt/local/etc/macports/macports.conf
$ sudo vim /opt/local/etc/macports/macports.conf
$ sudo chmod 444 /opt/local/etc/macports/macports.conf
# 再度、実行すると警告は消えています。
$ port installed inactive
None of the specified ports are installed.