当前位置:首页 > 编程笔记 > 正文
已解决

在 M1 芯片 Mac 上使用 Homebrew

来自网友在路上 11038103提问 提问时间:2023-11-09 18:21:52阅读次数: 103

最佳答案 问答题库1038位专家为你答疑解惑

在 M1 芯片 Mac 上使用 Homebrew

1.安装brew(国内源):

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

2.M1芯片安装完成后会出现,终端输入brew 会出现 zsh: command not found: brew 的问题

解决:这是配置项出错,brew的下载路径在/opt/homebrew/bin,所以我们要在 根目录创建zshrc,并写入相关的路径

touch .zshrc
open .zshrc

写入:

path=('/opt/homebrew/bin' $path)
export PATH

3.下载 php,mySql 推荐使用 PhpWebStudy, 推荐使用阿里的源

报错:

curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1) Error: php@8.3: Failed to download resource "php@8.3" Download failed: https://ghcr.io/v2/shivammathur/php/php/8.3/blobs/sha256:f429c0d4807e7daa511bec9099f7855cdb245f710b5fcd0a9bde8cdee314846e

解决:将HTTP版本从2降级到1.1后工作,相关的文章

git config --global http.version HTTP/1.1

下载完成后更改回来:

git config --global http.version HTTP/2

Php 第一次配置:

php@8.3 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.If you need to have php@8.3 first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/php@8.3/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/php@8.3/sbin:$PATH"' >> ~/.zshrcFor compilers to find php@8.3 you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/php@8.3/lib"
export CPPFLAGS="-I/opt/homebrew/opt/php@8.3/include"To start shivammathur/php/php@8.3 now and restart at login:
brew services start shivammathur/php/php@8.3
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/php@8.3/sbin/php-fpm --nodaemonize
echo 'export PATH="/opt/homebrew/opt/php@8.3/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/php@8.3/sbin:$PATH"' >> ~/.zshrc

@蚵仔煎-20231107

查看全文

99%的人还看了

猜你感兴趣

版权申明

本文"在 M1 芯片 Mac 上使用 Homebrew":http://eshow365.cn/6-36419-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!