うめすこんぶ

日々のプログラミングで残しておきたいメモ.何かの役に立てれば幸いです.

MacPortからHomebrewへの移行方法

スポンサーリンク

以下ページに従ってmacportをOSX10.10.5で使えるようにする。 そもそも、macportだけをアンインストールしようとしても、以下エラーでできない。

Error: Current platform "darwin 14" does not match expected platform "darwin 13" 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"

そこで、回り道になるが、macportをOSに合わせたものをインストールしてきて、 それをアンインストールするという手順を踏むことにする。 手順は以下。

  1. Xcodeを再インストール
  2. MacPortsを再インストール
  3. MacPortsでインストールしていたものを書き出して,一度全て消去.書き出したリストを使ってもう一度インストール

1. xcodeのインストール

インストールはせず、以下コマンド叩くだけ。

sudo xcode-select --install
sudo xcodebuild -license

2.「MacPortをインストール」

https://www.macports.org/install.php

このページからOSに該当するもの持ってきてダウンロード&インストール。

3.

※ 3.はもしかしたらこの手順すべてはいらないかもしれません。一応Migrationの手順に沿ってます。

port -qv installed > ports.list

とかでインストールしていたものを書き出し、

sudo port -f uninstall installed
sudo port clean all

で一度全て削除。

以下、スクリプトを持ってきて再インストール。

curl -0 https://svn.macports.org/repository/macports/contrib/restore_ports.tcl
chmod +x restore_ports.tcl
sudo ./restore_ports.tcl ports.list

アンインストール

次に、アンインストールする。

$ sudo port -fp uninstall --follow-dependents installed

残りの設定ファイル等を削除する。

sudo rm -rf \
  /opt/local \
  /Applications/DarwinPorts \
  /Applications/MacPorts \
  /Library/LaunchDaemons/org.macports.* \
  /Library/Receipts/DarwinPorts*.pkg \
  /Library/Receipts/MacPorts*.pkg \
  /Library/StartupItems/DarwinPortsStartup \
  /Library/Tcl/darwinports1.0 \
  /Library/Tcl/macports1.0 \
  ~/.macports

~/.bash_profileからMacPortsインストール時に追加した以下のPATHを削除。

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

Homebrewのインストール

/usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"

これにて完了。

参考文献