切り替えてみるとエラー、libicuio.70.dylibが無いみたい。
最新は libicudata.72.dylibとなっているらしい。→でエラー
$ brew unlink php@8.1
$ brew link php@7.4
$ vim .back_profile
--------------
#export PATH="/usr/local/opt/php@8.1/bin:$PATH"
#export PATH="/usr/local/opt/php@8.1/sbin:$PATH"
export PATH="/usr/local/opt/php@7.4/bin:$PATH"
export PATH="/usr/local/opt/php@7.4/sbin:$PATH"
--------------
$ php -v
dyld[80101]: Library not loaded: '/usr/local/opt/icu4c/lib/libicuio.70.dylib'
Referenced from: '/usr/local/Cellar/php@7.4/7.4.28_1/bin/php'
Reason: tried: '/usr/local/opt/icu4c/lib/libicuio.70.dylib' (no such file), '/usr/local/lib/libicuio.70.dylib' (no such file), '/usr/lib/libicuio.70.dylib' (no such file), '/usr/local/Cellar/icu4c/72.1/lib/libicuio.70.dylib' (no such file), '/usr/local/lib/libicuio.70.dylib' (no such file), '/usr/lib/libicuio.70.dylib' (no such file)
Abort trap: 6
brew tapで公式以外の formulaを持ってくる必要あり
$ brew tap-new yama/taps
$ brew extract icu4c yama/taps --version 70
エラー、Xcode:CommandLineToolsが古い?
$ brew install yama/taps/icu4c@70
==> Fetching yama/taps/icu4c@70
==> Downloading https://github.com/unicode-org/icu/releases/download/release-70-1/icu4c-70_1-src.tgz
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/49244766/2b364418-d38d-4d23-b918-11d1194d4cb6?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230428%2Fus-east-1%2
######################################################################################################################################################################################################################################## 100.0%
==> Installing icu4c@70 from yama/taps
Error: Your Command Line Tools are too outdated.
Update them from Software Update in System Preferences.
If that doesn't show you any updates, run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
Alternatively, manually download them from:
https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 14.2.
Xcode:CommandLineToolsを再インストール、icu4c@70をいインストール成功
$ sudo rm -rf /Library/Developer/CommandLineTools
$ sudo xcode-select --install
$ brew install yama/taps/icu4c@70
$ ll /usr/local/Cellar/ | grep icu
$ ll /usr/local/opt/ | grep icu4c
リンクを貼る
$ cd /usr/local/opt/icu4c/lib/
$ ln -s ../../../icu4c@70/70.1/lib/libicuio.70.1.dylib libicuio.70.dylib
$ ln -s ../../../icu4c@70/70.1/lib/libicui18n.70.1.dylib libicui18n.70.dylib
$ ln -s ../../../icu4c@70/70.1/lib/libicuuc.70.1.dylib libicuuc.70.dylib
$ ln -s ../../../icu4c@70/70.1/lib/libicudata.70.1.dylib libicudata.70.dylib
$ ln -s ../../../icu4c@70/70.1/lib/libicutest.70.1.dylib libicutest.70.dylib
$ ln -s ../../../icu4c@70/70.1/lib/libicutu.70.1.dylib libicutu.70.dylib
//確認
$ ll | grep '70.1'
lrwxr-xr-x 48 taka admin 28 4 18:03 libicudata.70.dylib -> ../../../icu4c@70/70.1/lib/libicudata.70.1.dylib
lrwxr-xr-x 48 taka admin 28 4 18:02 libicui18n.70.dylib -> ../../../icu4c@70/70.1/lib/libicui18n.70.1.dylib
lrwxr-xr-x 46 taka admin 28 4 18:02 libicuio.70.dylib -> ../../../icu4c@70/70.1/lib/libicuio.70.1.dylib
lrwxr-xr-x 48 taka admin 28 4 18:03 libicutest.70.dylib -> ../../../icu4c@70/70.1/lib/libicutest.70.1.dylib
lrwxr-xr-x 46 taka admin 28 4 18:03 libicutu.70.dylib -> ../../../icu4c@70/70.1/lib/libicutu.70.1.dylib
lrwxr-xr-x 46 taka admin 28 4 18:03 libicuuc.70.dylib -> ../../../icu4c@70/70.1/lib/libicuuc.70.1.dylib
復旧できました。
$ php -v
PHP 7.4.28 (cli) (built: Mar 1 2022 09:40:23) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Xdebug v3.1.3, Copyright (c) 2002-2022, by Derick Rethans
with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies