1. homebrew位置变了
原来的Cellar Homebrew Caskroom
都是在 /usr/local/
下面
M1在/opt/homebrew
下面
2. 装ruby
M1电脑安装ruby,装不上的问题
RUBY_CFLAGS="-w" rbenv install 2.7.4
装不上ruby 3.1.x, 报错如下:
Downloading ruby-3.1.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.2.tar.gz
Installing ruby-3.1.2...
ruby-build: using readline from homebrew
ruby-build: using gmp from homebrew
BUILD FAILED (macOS 11.6.8 using ruby-build 20221004)
Inspect or clean up the working tree at /var/folders/y5/vfyf5lqj655g_zbm8pvdgmkr0000gn/T/ruby-build.20221029165815.98770.ztN4k5
Results logged to /var/folders/y5/vfyf5lqj655g_zbm8pvdgmkr0000gn/T/ruby-build.20221029165815.98770.log
原因是:SIP is disabled.
解决:
1. 关机,启动电脑,长安进入恢复模式(hold down command+R during startup).
2. Go to the Utilities menu and open Terminal and type: csrutil enable.
3. Reboot into the OS.
4. 重新安装 rbenv install 3.1.2
3. 装puma报错
gem install puma -v '5.5.2' -- --with-openssl-dir=$(brew --prefix openssl)
3. 装nokogiri报错
arch -x86_64 gem install nokogiri -v '1.12.3' --platform=ruby -- --use-system-libraries
gem install nokogiri -v 1.8.2 --platform arm64-darwin -- --use-system-libraries
4. 安装gem报错就用arch -arch x86_64 gem install试试
arch -arch x86_64 gem install ffi
sudo gem update --system
5. rails c 报错
ruby版本2.7.1的 enum 的bug
[1,2,3].to_enum.next
- 解决方案: 把ruby版本升级到2.7.5
6. railsc里导出excel错误
- 解决方案:
export DISABLE_SPRING=true && export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
然后再开console导出