一、apt-get
参考https://www.finkproject.org/download/srcdist.php?phpLang=zh安装flink。不过20220114发现flink没有针对mac12.1的版本。那么只有再尝试安装brew。
在终端下输入命令(Mac自带ruby不需要安裝)
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
如果报错:
curl: (7) Failed to connect to raw.githubusercontent.com port 443 after 4 ms: Connection refused
参考https://www.jianshu.com/p/c2e829027b0a,不过20220114尝试后并未解决。各种搜索后终于找到了比较靠谱的安装方法。
brew下载地址:
https://github.com/Homebrew/brew/blob/master/Library/Homebrew/cmd/install.rb
最正宗的安装指导:
https://docs.brew.sh/Installation
二、gdb
brew install gdb失败
原来,截止20220114,M1的处理器不支持gdb。
参考https://www.mejorcodigo.com/p/96102.html
Homebrew is not (yet) supported on ARM processors!
https://stackoverflow.com/questions/64882584/how-to-run-the-homebrew-installer-under-rosetta-2-on-m1-macbook
arch -x86_64 brew install gdb
按照上面的命令安装也会报错:
Error: gdb dependencies not built for the x86_64 CPU architecture:
gmp was built for arm64
pkg-config was built for arm64
gdbm was built for arm64
mpdecimal was built for arm64
ca-certificates was built for arm64
openssl@1.1 was built for arm64
readline was built for arm64
sqlite was built for arm64
xz was built for arm64
python@3.10 was built for arm64
原来Mac下的XCode应该已经默认把gdb改成lldb了。
三、附录
可参考https://github.com/hawtim/blog/issues/10修改host文件。
SwitchHosts下载地址:
https://github.com/oldj/SwitchHosts/releases
x64应该是intel的,可选择arm64的版本进行下载。
安装完成后使用brew install XXX即可。