macOS更新到13,php命令失效,brew install php安装php报错 Warning: You are using macOS 13. We do not provide support for this pre-release version.

### 问题:m1的mac本昨天更新至macOS Ventura 13后,命令行里的php命令失效。

尝试解决:使用brew install php命令重新安装失败,提示如下

警告:您正在使用macOS 13。 我们不提供对这个预发布版本的支持。 您将遇到某些公式的构建失败。 请创建拉请求,而不是在Homebrew的GitHub上寻求帮助,

~  $ php -v                                                                                   127 ↵
zsh: command not found: php
~  $ brew install php                                                                         127 ↵
Warning: You are using macOS 13.
We do not provide support for this pre-release version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
pre-release version.

Error: m4: no bottle available!
You can try to install from source with:
  brew install --build-from-source m4
Please note building from source is unsupported. You will encounter build
failures with some formulae. If you experience any issues please create pull
requests instead of asking for help on Homebrew's GitHub, Twitter or any other
official channels.
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
Buffett-Cai
最佳答案
  1. MacOS之前的版本是自带PHP的。macOS13开始砍掉了PHP。
  2. homebrew 现在是有适用于arm64_ventura的PHP的,你那还没有的建议更新一下homebrew。老版本的PHP没有维护了,你指定装老版本正常情况下是装不上的,用homebrew装老版本(PHP7以及之前)自己慢慢研究有很多文档的,或者直接用docker
1年前 评论
讨论数量: 15

我是在 macOS 12 安装的,升级到 macOS 13 后 php 都正常,你原先老版本的系统里面 PHP 用什么方式装的?

$ php -v
PHP 8.1.13 (cli) (built: Nov 24 2022 15:58:42) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.13, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.13, Copyright (c), by Zend Technologies

$ sw_vers
ProductName:         macOS
ProductVersion:      13.0.1
BuildVersion:        22A400
1年前 评论
遇白 (楼主) 1年前
GeorgeKing (作者) 1年前
遇白 (楼主) 1年前

我的 PHP7.4 和 PHP8.1 共存。Intel,macOS 13。

1年前 评论
遇白 (楼主) 1年前
PHP 7.3.33 (cli) (built: Nov 11 2022 07:38:47) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies

ProductName:        macOS
ProductVersion:        13.0.1
BuildVersion:        22A400

升级的时候没遇到任何问题 , 用brew 装的php。
实在不行 直接卸载重新装试试 ?

1年前 评论
遇白 (楼主) 1年前

推荐用 brew-php-switcher 可以一个命令直接切换版本,还是很方便的 :grinning:

1年前 评论
颠倒的玉石 1年前
遇白 (楼主) 1年前

brew install --build-from-source m4 执行这个

1年前 评论
遇白 (楼主) 1年前
Buffett-Cai
  1. MacOS之前的版本是自带PHP的。macOS13开始砍掉了PHP。
  2. homebrew 现在是有适用于arm64_ventura的PHP的,你那还没有的建议更新一下homebrew。老版本的PHP没有维护了,你指定装老版本正常情况下是装不上的,用homebrew装老版本(PHP7以及之前)自己慢慢研究有很多文档的,或者直接用docker
1年前 评论

交作业:

brew update 
brew install --build-from-source apr 
brew install php 

成功!

1年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!