当前位置:   article > 正文

在 M1 芯片 Mac 上使用 Homebrew_mac m1 homebrew

mac m1 homebrew

在 M1 芯片 Mac 上使用 Homebrew

1.安装brew(国内源):

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

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

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

touch .zshrc
open .zshrc
  • 1
  • 2

写入:

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

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
  • 1

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

git config --global http.version HTTP/1.1
  • 1

下载完成后更改回来:

git config --global http.version HTTP/2
  • 1

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"' >> ~/.zshrc

For 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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
echo 'export PATH="/opt/homebrew/opt/php@8.3/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/php@8.3/sbin:$PATH"' >> ~/.zshrc
  • 1
  • 2

@蚵仔煎-20231107

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小舞很执着/article/detail/876496
推荐阅读
  

闽ICP备14008679号