3 MacPorts の更新

http://nalab.mind.meiji.ac.jp/~mk/labo/text/upgrading-my-env/node12.html

MacPorts というのは、 Mac で利用できるオープンソースのフリーソフト (MacPorts では、これらフリーソフトのことを port と呼びます) を、 手軽にインストール・管理するためのソフトウェアです。

現象数理学科 Mac では、MacPorts 自体と、 それを用いていくつかのソフトをインストールしてあります。

GLSC3D のインストールに必要なフリーソフトを、 MacPorts を利用してインストールするため、 MacPorts の更新作業が必要になります。

MacPorts は、通常は以下のようにして更新が出来ます。 ダメ元でやってみましょう。
sudo port selfupdate
sudo port upgrade outdated

(sudo は管理者権限でコマンドを実行するためのコマンドです。 使っている Mac のアカウントのパスワードが尋ねられます。 パスワードを入力しても、人に見られないようにするため、 画面には表示されません。最後まで打ってから [return] して下さい。)

macOS を更新したときなどは、上の手順では更新出来ない可能性が高いです。 その場合は MacPorts の最新版をインストールする必要があるかもしれません。

  1. MacPorts base を再インストール (https://www.macports.org/install.php) する。 もしも macports.conf がデフォールトでない場合は更新する。

    macports.conf がデフォールトでない場合は、

    If your macports.conf (typically at /opt/local/etc/macports/macports.conf) contains uncommented settings for universal_archs or build_arch, you will likely want to update them, since unlike earlier OS versions, the compiler on Snow Leopard and later will build for x86_64 by default on systems that support it. The default values will be fine for almost all users, so unless you know you need something different, just comment out these two lines. Several other settings in macports.conf have changed their defaults over the years. Take a moment to compare each line of your macports.conf with the corresponding line in macports.conf.default in the same directory. Unless you know a reason why a line in your settings file should be different from the defaults, adopt the line from the defaults file.
    とあるけれど、 自分で macports.conf を修正した覚えのない人は無視して良い。 (大体、自分で macports.conf を書き換えるような人は、 こんなページ読まないだろう。)
  2. ターミナルで以下のコマンドを実行する。
    port -qv installed > myports.txt
    port echo requested | cut -d ' ' -f 1 > requested.txt
    sudo port -f uninstall installed
    sudo rm -rf /opt/local/var/macports/build/*
    curl --location --remote-name https://github.com/macports/macports-contrib/raw/master/restore_ports/restore_ports.tcl
    chmod +x restore_ports.tcl
    sudo ./restore_ports.tcl myports.txt
    
    (現在インストールされている ports の記録を取ってから、 アンインストールして、それから記録を元に ports をインストールし直す。)

桂田 祐史
2019-12-02