git

➜  ~ git -h
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

发现git无法使用,先确认git是否安装好了

➜  ~ which git
/usr/bin/git

git应该是没问题的。查询后得知需要重新安装 CommandLineTools

xcode-select --install

安装之后git恢复正常使用

php

php扩展失效

尝试启动php-fpm,发现报出warning,无法找到扩展文件。 这个其实小事情,重新安装不是问题。但是重新安装过程,发现phpize无法使用。

➜  phpredis git:(develop) ✗ phpize
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
autoconf: warning: both `configure.ac' and `configure.in' are present.
autoconf: warning: proceeding with `configure.ac'.
autoheader: 'configure.ac' and 'configure.in' both present.
autoheader: proceeding with 'configure.ac'

最终发现是之前在 /usr/include 的软链,更新之后因为苹果关于系统盘的保护,之前在根目录中做的操作都被迁移到 /Users/Shared/Relocated Items 中。

About the read-only system volume in macOS Catalina
https://support.apple.com/en-us/HT210650

因为明天就要上班了,优先恢复开发环境使用,强行mount根目录,对根目录进行操作。

  • 先找到在10.15 Catalina中的SDK文件
➜  ~ xcrun --show-sdk-path
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
  • 在里面可以找到 /usr/include
➜  main pwd
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/php/main
  • 关闭SIP,挂载根目录
➜  ~ csrutil status
System Integrity Protection status: disabled.
# 我这里已经提示为 disabled ,在之前系统中我已经关闭了。这里不再赘述如何关闭SIP
➜  ~ sudo mount -uw /
  • 建立软链接
➜  ~ sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ /usr/include
  • 下载/安装redis扩展
# 在官网下载最新版扩展包 https://pecl.php.net/package/redis
-> wget https://pecl.php.net/get/redis-5.0.2.tgz
-> tar zxvf redis-5.0.2.tgz
-> cd redis-5.0.2
➜  redis-5.0.2 phpize
Configuring for:
PHP Api Version:         20180731
Zend Module Api No:      20180731
Zend Extension Api No:   320180731
➜  redis-5.0.2 ./configure --with-php-config=/usr/bin/php-config
➜  redis-5.0.2 make
➜  redis-5.0.2 sudo make install
Password:
Installing shared extensions:     /usr/lib/php/extensions/no-debug-non-zts-20180731/

# 完成
文章目录