首先装置 libyaml

$ brew install libyaml==> Downloading https://ghcr.io/v2/homebrew/core/libyaml/manifests/0.2.5######################################################################## 100.0%==> Downloading https://ghcr.io/v2/homebrew/core/libyaml/blobs/sha256:a436da33a05f805258c5951a365dec4e8d70a908dbe5dacdeb6b2ecd0efd5024==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:a436da33a05f805258c5951a365dec4e8d70a908dbe5dacdeb6b2ecd0efd5024?se=2021-11-05T09%3A00%3######################################################################## 100.0%==> Pouring libyaml--0.2.5.arm64_monterey.bottle.tar.gz  /opt/homebrew/Cellar/libyaml/0.2.5: 10 files, 353KB

记录一下这一步里的libyaml门路:

/opt/homebrew/Cellar/libyaml/0.2.5

而后装置 yaml

$ pecl install yaml.......Please provide the prefix of libyaml installation [autodetect] : 

粘贴上一步失去的libyaml门路

装置实现,检查一下

$ php -m | grep yamlyaml