参考URL
macportsでインストールができない -macportsはインストール済みです。- その他(OS) | 教えて!goo https://oshiete.goo.ne.jp/qa/7598217.html$ port search gcc Warning: Can't open index file for source: rsync://rsync.macports.org/macports/release/tarballs/ports.tar Error: search for name gcc failed: No index(es) found! Have you synced your port definitions? Try running 'port selfupdate'. No match for gcc found
と出てしまった。
参考URL先にならって
$sudo vi /opt/local/etc/macports/sources.conf
#rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default]
http://www.macports.org/files/ports.tar.gz [default]
最下部のrsyncの行をコメントアウトし、新たに赤字の部分を加筆する。
そのあとポートをアップデートする。
$ sudo port -d sync DEBUG: Copying /Users/yoshioka-hiroaki/Library/Preferences/com.apple.dt.Xcode.plist to /opt/local/var/macports/home/Library/Preferences ---> Updating the ports tree Synchronizing local ports tree from http://www.macports.org/files/ports.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 178 100 178 0 0 679 0 --:--:-- --:--:-- --:--:-- 679 100 32.7M 100 32.7M 0 0 3239k 0 0:00:10 0:00:10 --:--:-- 4352k
(以下略)このように更新されれば、OK。