TLDR:Apple M1 下用 macports 能實現大部分 command line tools 的 native execution (不用 rosetta2 )。
剛從 Apple Store 拿到 MacBook Air 乞丐版,第一件事安裝 macports 。驚訝地發現 macports 已經是 arm64-native 了,而且 macports 下的大部分 packages 也都在 arm64 架構 pre-compiled 過了,直接可以安裝。那些尚未 pre-compiled 的可以在本地 compile 。結果就是,command line tools 基本都適配 Apple M1 。
結論:常見的 command line tools 對 Apple M1 的適配得不錯。
附錄:我用 macports 安裝 mutt 和 tmux 的日誌。我們會看到,除了 mutt 以外,其他 packages 都是直接安裝,而 mutt 需要本地 build 。
>> sudo port install tmux mutt
Password:
---> Computing dependencies for tmux
The following dependencies will be installed: libevent
Continue? [Y/n]: Y
---> Fetching archive for libevent
---> Attempting to fetch libevent-2.1.12_0.darwin_20.arm64.tbz2 from https://packages.macports.org/libevent
---> Attempting to fetch libevent-2.1.12_0.darwin_20.arm64.tbz2.rmd160 from https://packages.macports.org/libevent
---> Installing libevent @2.1.12_0
---> Activating libevent @2.1.12_0
---> Cleaning libevent
---> Fetching archive for tmux
---> Attempting to fetch tmux-3.1c_0.darwin_20.arm64.tbz2 from https://packages.macports.org/tmux
---> Attempting to fetch tmux-3.1c_0.darwin_20.arm64.tbz2.rmd160 from https://packages.macports.org/tmux
---> Installing tmux @3.1c_0
---> Activating tmux @3.1c_0
---> Cleaning tmux
---> Computing dependencies for mutt
The following dependencies will be installed:
curl-ca-bundle
gnutls
libidn2
libtasn1
libunistring
nettle
p11-kit
Continue? [Y/n]: Y
---> Fetching archive for curl-ca-bundle
---> Attempting to fetch curl-ca-bundle-7.73.0_0.darwin_20.noarch.tbz2 from https://packages.macports.org/curl-ca-bundle
---> Attempting to fetch curl-ca-bundle-7.73.0_0.darwin_20.noarch.tbz2.rmd160 from https://packages.macports.org/curl-ca-bundle
---> Installing curl-ca-bundle @7.73.0_0
---> Activating curl-ca-bundle @7.73.0_0
---> Cleaning curl-ca-bundle
---> Fetching archive for libunistring
---> Attempting to fetch libunistring-0.9.10_0.darwin_20.arm64.tbz2 from https://packages.macports.org/libunistring
---> Attempting to fetch libunistring-0.9.10_0.darwin_20.arm64.tbz2.rmd160 from https://packages.macports.org/libunistring
---> Installing libunistring @0.9.10_0
---> Activating libunistring @0.9.10_0
---> Cleaning libunistring
---> Fetching archive for libidn2
---> Attempting to fetch libidn2-2.3.0_0.darwin_20.arm64.tbz2 from https://packages.macports.org/libidn2
---> Attempting to fetch libidn2-2.3.0_0.darwin_20.arm64.tbz2.rmd160 from https://packages.macports.org/libidn2
---> Installing libidn2 @2.3.0_0
---> Activating libidn2 @2.3.0_0
---> Cleaning libidn2
---> Fetching archive for libtasn1
---> Attempting to fetch libtasn1-4.16.0_0.darwin_20.arm64.tbz2 from https://packages.macports.org/libtasn1
---> Attempting to fetch libtasn1-4.16.0_0.darwin_20.arm64.tbz2.rmd160 from https://packages.macports.org/libtasn1
---> Installing libtasn1 @4.16.0_0
---> Activating libtasn1 @4.16.0_0
---> Cleaning libtasn1
---> Fetching archive for nettle
---> Attempting to fetch nettle-3.6_0.darwin_20.arm64.tbz2 from https://packages.macports.org/nettle
---> Attempting to fetch nettle-3.6_0.darwin_20.arm64.tbz2.rmd160 from https://packages.macports.org/nettle
---> Installing nettle @3.6_0
---> Activating nettle @3.6_0
---> Cleaning nettle
---> Fetching archive for p11-kit
---> Attempting to fetch p11-kit-0.23.21_0.darwin_20.arm64.tbz2 from https://packages.macports.org/p11-kit
---> Attempting to fetch p11-kit-0.23.21_0.darwin_20.arm64.tbz2.rmd160 from https://packages.macports.org/p11-kit
---> Installing p11-kit @0.23.21_0
---> Activating p11-kit @0.23.21_0
---> Cleaning p11-kit
---> Fetching archive for gnutls
---> Attempting to fetch gnutls-3.6.15_0+doc.darwin_20.arm64.tbz2 from https://packages.macports.org/gnutls
---> Attempting to fetch gnutls-3.6.15_0+doc.darwin_20.arm64.tbz2.rmd160 from https://packages.macports.org/gnutls
---> Installing gnutls @3.6.15_0+doc
---> Activating gnutls @3.6.15_0+doc
---> Cleaning gnutls
---> Fetching archive for mutt
---> Attempting to fetch mutt-2.0.0_0+gnutls+idn+imap+pop+smtp.darwin_20.arm64.tbz2 from https://packages.macports.org/mutt
---> Attempting to fetch mutt-2.0.0_0+gnutls+idn+imap+pop+smtp.darwin_20.arm64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/mutt/mutt
---> Attempting to fetch mutt-2.0.0_0+gnutls+idn+imap+pop+smtp.darwin_20.arm64.tbz2 from https://mse.uk.packages.macports.org/mutt
---> Fetching distfiles for mutt
---> Attempting to fetch mutt-2.0.0.tar.gz from https://bitbucket.org/mutt/mutt/downloads/
---> Verifying checksums for mutt
---> Extracting mutt
---> Configuring mutt
---> Building mutt
---> Staging mutt into destroot
---> Installing mutt @2.0.0_0+gnutls+idn+imap+pop+smtp
---> Activating mutt @2.0.0_0+gnutls+idn+imap+pop+smtp
---> Cleaning mutt
---> Updating database of binaries
---> Scanning binaries for linking errors
---> No broken files found.
---> No broken ports found.
---> Some of the ports you installed have notes:
tmux has the following notes:
If you want integration with system pasteboard consider installing port tmux-pasteboard as well
>>
1
czhu 2020-11-24 12:04:31 +08:00
👍 那 brew 怎么还不支持 M1 说还要好几个月
|
3
czhu 2020-11-24 12:09:16 +08:00
@Harry1993 有 brew 那样的 cask 支持吗?
当年我记得 macports 的毛病是什么都要自己编译 特别占空间 而且每次升级都慢 |
4
Harry1993 OP @czhu 我的 iterm2 就是用 macports 裝的:port install iterm2 。spotlight 也能自動找到。
估計現在 macports 優化好了吧。現在大部分 app 都可以直接安裝,不需要本地編譯。 |
5
czhu 2020-11-24 12:28:55 +08:00
|
6
ryh 2020-11-24 13:40:52 +08:00
自从 macports 被 rvm 默认安装,而 macports 还自动建了用户名和用户组 我就对它没有好感(强盗逻辑啊)
看了下 https://packages.macports.org/?C=M;O=D 11 月 22 日以后更新了不少,但绝对没超过它所以 packages 的 20% |
7
AkideLiu 2020-11-25 00:01:40 +08:00 via iPhone
macports 很棒我用 brew
|
8
Binboy 2020-12-12 11:05:03 +08:00
brew 对 M1 的支持迟迟还没来,尝试下
|
9
sinxccc 2020-12-14 01:13:33 +08:00
@czhu 现在 macOS 系统的方向是 base system 尽量可能小而且 read only 。系统给提供的库已经非常少,而且并不推荐第三方软件使用了。
现在即使是 homebrew,需要在包管理器内部解决的依赖也是越来越多,homebrew 使用 keg only 来解决跟系统包重复的问题。从这个角度的话,macports 选择的方向没有什么问题。 Homebrew 的 Apple Silicon 进度的话,我自己的尝试,到今天( 2020-12-13 )为止,如果你按照推荐安装在 /opt/homebrew 下的话,很多包也已经有了 arm64 的 bottled,剩下的自己编译也基本可以。剩下还有问题的只有 go 和 rust 的依赖,这个只能等上游发布新版本了。 不过 Homebrew 这次的操作有点迷,如果它坚持 arm64 只能安装在 /opt/homebrew 的话,无异于放弃了一直以来宣传的无缝便利(因为所有的包在 /usr/local 下)。 |
10
sinxccc 2020-12-14 01:18:04 +08:00
@Harry1993 类似 cask 的支持在 macports 里其实是没有的,你看到的 iTerm2 也是 macports 自己编译的版本。换句话说,只有开源的 app 才有收录进 aqua 下的可能。
|
11
Harry1993 OP @sinxccc 我有個疑問,我自己 build 了 go (參照 https://gist.github.com/Dids/dbe6356377e2a0b0dc8eacb0101dc3a7 ),我如何能告訴 homebrew 或者 macports 去哪裡找到本地的 go,於是他們在安裝(依賴 go 的) ports 不用另外再去安裝 go (通常是失敗的)?
python38,openjdk 也有同樣的問題:我自己有一套 arm64-native 的環境,如何讓 homebrew 或者 macports 找到並依賴他們? |