helen's blog

ぽんこつによるぽんこつのためのぽんこつブログ

OSアップデートしたらMacPortsが死んでた件

作業開始前OS:Yosemite 10.10.4

$ port list
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"
Error: /opt/local/bin/port: Failed to initialize MacPorts, OS platform mismatch

macのOSをMavericksからYosemiteアップデートしたら
Macportsが死んでいたので
これを機にMacportsを削除しちゃおうかと

$ sudo port -fp uninstall --follow-dependents installed
Password:
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"
Error: /opt/local/bin/port: Failed to initialize MacPorts, OS platform mismatch

当然だけどアンインストールコマンドも効かない
おとなしくMigration – MacPortsを参照すると

  1. Xcodeとthe Xcode command line toolsの最新化
  2. Macports base入れなおし
  3. ports入れなおし

だそうですがめんどくさい

そもそもOSが10.10.4で今後も困りそうなので
10.10.5にアップデートしてmacportsを改めてインストール
The MacPorts Project -- Download & Installation

$ sudo port -v selfupdate
--->  Updating MacPorts base sources using rsync
receiving file list ... done

sent 36 bytes  received 69 bytes  70.00 bytes/sec
total size is 27013120  speedup is 257267.81
receiving file list ... done

sent 36 bytes  received 76 bytes  74.67 bytes/sec
total size is 512  speedup is 4.57
MacPorts base version 2.3.4 installed,
MacPorts base version 2.3.4 downloaded.
--->  Updating the ports tree
Synchronizing local ports tree from rsync://rsync.macports.org/release/tarballs/ports.tar
receiving file list ... done

sent 36 bytes  received 70 bytes  70.67 bytes/sec
total size is 62883840  speedup is 593243.77
receiving file list ... done

sent 36 bytes  received 77 bytes  75.33 bytes/sec
total size is 512  speedup is 4.53
Creating port index in /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports

Total number of ports parsed:	0
Ports successfully parsed:	0
Ports failed:			0
Up-to-date ports skipped:	20510

--->  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 -fp uninstall installed
--->  Uninstalling curl-ca-bundle @7.33.0_0
--->  Cleaning curl-ca-bundle
--->  Deactivating curl-ca-bundle @7.37.1_0
--->  Cleaning curl-ca-bundle
--->  Uninstalling curl-ca-bundle @7.37.1_0
--->  Cleaning curl-ca-bundle
--->  Deactivating expat @2.1.0_0
--->  Cleaning expat
--->  Uninstalling expat @2.1.0_0
--->  Cleaning expat
--->  Deactivating gperf @3.0.4_2
--->  Cleaning gperf
--->  Uninstalling gperf @3.0.4_2
--->  Cleaning gperf
--->  Deactivating libiconv @1.14_0
--->  Cleaning libiconv
--->  Uninstalling libiconv @1.14_0
--->  Cleaning libiconv
--->  Deactivating m4 @1.4.16_0
--->  Cleaning m4
--->  Uninstalling m4 @1.4.16_0
--->  Cleaning m4
--->  Uninstalling ncurses @5.9_2
--->  Cleaning ncurses
--->  Deactivating nkf @2.1.3_3
--->  Cleaning nkf
--->  Uninstalling nkf @2.1.3_3
--->  Cleaning nkf

以下もゴミ掃除で実行する必要があるそうなので実行

$ 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

確認してみた

$  port list
-bash: port: command not found

portsアンインストール成功!

気のせいかもしれないけどおかげで1GBほど空きができました
複数回macportsをインストールした痕跡があるので
pathだけ綺麗にしたらおわり!やったね!