LoginSignup
12
11

More than 5 years have passed since last update.

OS X El Capitan にアップデートした際に MacPorts を動くようにする

Posted at

sudo port selfupdate でエラーが発生する

$ sudo port selfupdate
Password:
Error: Current platform "darwin 15" does not match expected platform "darwin 14"
Error: If you upgraded your OS, please follow the migration instructions: https://trac.macports.org/wiki/Migration
OS platform mismatch
    while executing
"mportinit ui_options global_options global_variations"
Error: /opt/local/bin/port: Failed to initialize MacPorts, OS platform mismatch

対処法

下記を参考にして、MacPortsを再度インストール

Migration – MacPorts

Xcode の最新版インストール

Xcode and the Xcode Command Line Tools のインストール

$ xcode-select --install
xcode-select: note: install requested for command line developer tools

Xcode license に同意する

$ sudo xcodebuild -license

Enter -> space space space ... -> agree

最新版のインストールができているかの確認

$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

MacPorts の最新版インストール

MacPorts のインストール

下記の OS X 10.11 El Capitan を選択。

The MacPorts Project -- Download & Installation

最新版のインストールができているか確認

$ sudo port selfupdate
Password:
--->  Updating MacPorts base sources using rsync
MacPorts base version 2.3.4 installed,
MacPorts base version 2.3.4 downloaded.
--->  Updating the ports tree
--->  MacPorts base is already the latest version

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

更新可能なパッケージをアップグレードする

$ sudo port upgrade outdated のように実行するとパッケージがアップグレードされても古いバージョンが残ってしまうが、$ sudo port -u upgrade outdated のように -u のオプションを付けて実行すると古いバージョンが残らない。
好みでどちらかのコマンドを実行。

古い deactive されたバージョンを削除したい場合は $ sudo port uninstall inactive を実行。

$ sudo port upgrade outdated
…
Error: dyld-headers is obsolete; please uninstall it.
Error: org.macports.configure for port dyld-headers returned: obsolete port
Please see the log file for port dyld-headers for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_dyld-headers/dyld-headers/main.log
Error: Unable to upgrade port: 1
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets

( 自分の場合は ) 上記のエラーが出たので指示通り dyld-headers をアンインストールする。

$ sudo port uninstall dyld-headers
Password:
--->  Deactivating dyld-headers @239.3_0
--->  Cleaning dyld-headers
--->  Uninstalling dyld-headers @239.3_0
--->  Cleaning dyld-headers

再度パッケージをアップグレードする。

$ sudo port upgrade outdated
…
--->  Updating database of binaries
--->  Scanning binaries for linking errors
--->  No broken files found.

ports が全てアップデートされているか確認

$ port outdated
No installed ports are outdated.
12
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
11