Categories
common

从CLOVER迁移到OpenCore的流水记录

我之前有台黑苹果开发机一直使用着CLOVER驱动Catalina,运行稳定可靠,日常开发使用也很顺手。 机器的配置如下

  • Intel 第八代CPU i3 8100
  • 华硕H110M-K D3 MATX主板 (魔改BIOS,为了支持i3 8100)
  • 8G x 2 DDR3 1600 AMD专用内存
  • Micron 1100 256 GB固态硬盘
  • 电源是Huntkey SUPER 400N 300瓦
  • Fenvi FV-T919 BCM94360 WiFi/Bluetooth PCI-E card
  • 显卡是RX560,为了驱动双屏

这套配置相当经济实惠,魔改程度也在可接受的范围之内。不出意外还可以再战两年

迁移OpenCore,并升级Big Sur

今年一直被各种安利OpenCore的好处,比如启动迅速,配置简练,什么各种驱动今后只支持OpenCore。很馋人。

再加上Big Sur正式版也已经发布一段时间,我在Macbook上使用的还挺习惯,为了更方便的升级到Big Sur,也需要迁移到OpenCore。回想起每次macOS的大版本更新,升级过程中总是会出点小意外耽误一些时间,这个迁移令人忐忑不安

经过两天折腾,成功完成升级。这里将EFI文件推送到了GitHub,README文件中有简单的文件介绍。下面是迁移的流水帐

  • 阅读OpenCore迁移文档,内容很多看的头晕脑涨。有点想放弃
  • 使用OC GEN-X工具快速生成OpenCore的EFI文件,并安装到移动硬盘上测试是否能够启动原Catalina。启动失败并黑屏ACPI Error
  • 检查BIOS设置,基本上和之前安装CLOVER一样,不用改动
  • 在Google上爬文看看有没有倒霉蛋碰到和我相同的问题,不太走运
  • 在GitHub上没有搜索到同款主板相关的EFI文件
  • 至此已经消耗两天时间,准备放弃
  • 最后的思路是搜索H110M相关的OpenCore EFI文件,复制其中的config.plist以及ACPI驱动,略作修改居然成功点亮Catalina
  • 将测试好的EFI文件从移动硬盘复制到固态硬盘,接着直接更新Big Sur,这个步骤简单的令人诧异,接近我使用白苹果的体验
Categories
common

xcrun: error: active developer path (“/Applications/Xcode.app/Contents/Developer”) does not exist

前不久安装了macOS Big Sur beta,然后Xcode就不能工作了,需要更新到相应的beta版。我实际也没有使用到Xcode,所以删除了Xcode.app并安装Beta版本的Command Line Tools即可满足需求。

出现这个错误是因为跑make的时候路径仍然是旧的Xcode路径

$ make
xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
See `man xcode-select` for more details.

这里尝试修复但是没有奏效

$ sudo xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

只能reset,之后make就可以顺利运行了

sudo xcode-select --reset
Categories
common

如何升级老迈的Mac到macOS Catalina

不久前macOS Catalina 10.15正式版发布,想到还有一台吃灰许久的Mac mini 2011mid,这个老机器我已经替换了SSD硬盘,加了内存,日常浏览网页也不觉得吃力。再加上从前用这台机器做过业余私活赚过些许外快,也有些感情。也许可以升级到最新的macOS? 但是在App Store中直接安装macOS Catalina却得到了此机型已经不被支持的提示,大失所望。

macOS Catalina仅支持这些机型:
  • MacBook (Early 2015 or newer)
  • MacBook Air (Mid 2012 or newer)
  • MacBook Pro (Mid 2012 or newer)
  • Mac mini (Late 2012 or newer)
  • iMac (Late 2012 or newer)
  • iMac Pro (2017)
  • Mac Pro (Late 2013 or newer)
那么我的老机器是不是永远的停留在High Sierra呢?倒也不是无法可想。有个叫macOS Catalina Patcher的软件可以对安装包打个补丁,从而达到老树开新芽的目的。

开始升级Mac mini 2011mid到macOS Catalina

  • 下载macOS Catalina Patcher
  • 确认磁盘格式为APFS
  • 运行Patcher
  • 在下一屏,选择”Download a Copy”. 如果已经下载好了则可以选择”Browse a Copy..”
  • 下载需要等待一些时间,大概8G左右。下载完成后,可以选择制作启动盘或者直接升级,由于这台老机器并不常用,所以我毫无压力的选择了直接升级
  • 现在弹出提示,由于启用了SIP(System Integrity Protection),无法升级,需要重启到恢复模式(macOS Recovery)禁用SIP。
  • 选择重启电脑,并按住Command+R键不放,此时顺利进入恢复模式
  • 在恢复模式中的顶部菜单条选择Terminal,并输入 csrutil disable , 重启机器
  • 重启完成后再次打开Patcher -> “Browse a Copy”并选中上次已经下载的”Install macOS Catalina”安装包 -> 直接升级
  • 等待安装,期间会重启数次,升级完成。这个过程中与正常的升级体验并无二致
  • 体验macOS Catalina

遗留问题

  • 第一次初始化时卡住了较长时间,再次重启后此问题消失不见
Categories
javascript

Install semantic-ui by yarn

semantic-ui has some interactive installation step that Yarn does not support.

Install semantic-ui with macOS

yarn global add gulp
yarn add semantic-ui --ignore-scripts
cd ./node_modules/semantic-ui/
gulp install

Go back to semantic directory and start build

cd ../../semantic
gulp build
Categories
common

在macOS下安装aria2并自动启动RPC

什么是Aria2?

Aria2 is a lightweight download software with Multi-Connection support. Besides HTTP(s) and FTP, it also supports BitTorrent and Metalink.

安装Aria2

最简单的方法是采用homebrew安装aria2

brew install aria2

配置RPC自启动

  • 新增文件并编辑 /usr/local/opt/aria2/homebrew.mxcl.aria2.plist, 内容如下
<!--?xml version="1.0" encoding="UTF-8"?-->
<plist version="1.0">
    <dict>
<key>Label</key>
<string>homebrew.mxcl.aria2</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/opt/aria2/bin/aria2c</string>
<string>--enable-rpc=true</string>
<string>--rpc-secret=yoursecret</string>
<string>--rpc-allow-origin-all=true</string>
<string>--rpc-listen-all=true</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
  • 然后用homebrew启动这个service,默认端口是6800
brew services start aria2
Categories
common

My hackintosh build

High Sierra 10.13.5

Components

  • i3 8100
  • ASUS h110m-k d3 MATX board (Add micro code to BIOS, support i3 8100)
  • 8G x 2 DDR3 1600 RAM (For AMD only)
  • Micron 1100 256 GB Solid State Drive
  • Huntkey SUPER 400N 300 Watt SMPS
  • Fenvi FV-T919 BCM94360 WiFi/Bluetooth PCI-E card

The build use integrated graphics Intel UHD 630. The Fenvi FV-T919 card can be driven directly without any changes. I can use my old apple keyboard and trackpad perfectly.

Update BIOS for ASUS motherboard

ASUS h110m-k d3 can’t support i3 8100 directly. But I bought the motherboard from taobao and the seller changed the BIOS to ASRock motherboard already. The motherboard can work with i3 8100 directly but many options are missed for ASUS motherboard T_T

I re-flashed another BIOS file from here. Please note: the default CPU core voltage is too high for i3 8100 in the new BIOS. I change it to 1.040 volt.

I re-flashed a modified BIOS here. The BIOS supports 1.040 CPU volt default.

BIOS

See the section “Recommended BIOS Settings” at tonymacx86

For iGPU i3 8100, add the bios option

  • Graphics Configuration → DVMT Pre-Allocated : 128MB

The Installation

I followed the Installation Guide at tonymacx86. I used UniBeast to create a bootable High Sierra install on a 16GB USB drive to both format the internal SSD and install macOS.

Options for UniBeast:

  • PCI Devices
    • USB Ownership
    • USB InjectAll

Problem: The USB keyboard and mouse can’t work at the installation screen. I copied the USBInjectAll.kext to /EFI/CLOVER/Kexts/Other and it works again.

Post installation for MultiBeast

  • UEFI Boot mode
  • Drivers > Audio > Realtek ALCxxx > ALC887/888b
  • Drivers > Misc > FakeSMC
  • Drivers > Network > Realtek > RealtekRTL8111 v2.2.2
  • Drivers > USB > Remove XHCI USB port limit
  • Drivers > USB > USBInjectAll
  • Graphics > Intel Graphics Fixup
  • SMBIOS: 17,1

For Intel UHD 630 graphics:

I copied drivers from RehabMan

EFI/CLOVER/Kexts/Other:

  • AppleIntelKBLGraphicsFramebufferInjector_3e9x.kext
  • FakePCIID_Intel_HD_Graphics.kext
  • FakePCIID.kext
  • IntelGraphicsFixup.kext
  • Lilu.kext
  • Shiki.kext

Edit config.plist with Clover Configurator

  • Bootflag: shikigva=1
  • Devices/FakeID/IntelGFX: 0x3E928086
  • Graphics: Inject Intel – Empty ig-platform-id
  • SMBIOS: 17,1

Problem

  • Sleep: Can’t wake from sleep mode

Files

Update From 10.13.6 To 10.14.0

  • Install latest Lilu.kext and WhatEverGreen.kext
  • Install Multibeast 11 (not available yet)
  • Remove:
    • FakePCIID_Intel_HD_Graphics.kext
    • AppleIntelKBLGraphicsFramebufferInjector_3e9x.kext
    • IntelGraphicsFixup.kext
    • Shiki.kext
    • Bootflag: shikigva=1
    • Devices/FakeID/IntelGFX: 0x3E928086
  • Install Mojave from App Store
  • Follow the link Mojave AppleHDA Audio to remove old realtekALC and install AppleALC

Update From 10.14 To 10.15

  • I added a RX560 for support multiple monitors
  • Install latest Lilu, WhatEverGreen and AppleALC
  • Disable the UHD 630 in BIOS
  • Install Catalina from App Store
Categories
php

Install extension for macOS built-in PHP

macOS High Sierra 10.13.3 ships with PHP 7.1.7. I’m trying to install an extension for the built-in PHP. I tried the pecl command but no lucky because SIP (System Integrity Protection) protection. I can’t add file under the directory /usr/lib/php that default php extension directory.

It’s a little difficult but I installed an extension success by compiling manually

Prepare

  • Install packages
brew install autoconf pcre
  • Download PHP source files for built-in PHP
xcode-select --install
  • Edit the /etc/php.ini, change the extension_dir to /usr/local/lib/php/extensions. The directory is writable. You should make the directory yourself.
  • Copy all extension files from /usr/lib/php/extensions to /usr/local/lib/php/extensions
  • Download the extension file and compile it
  • Edit /usr/bin/php-config, find line
extension_dir='/usr/local/lib/php/extensions/no-debug-non-zts-20090626'

and replace it with

extension_dir='/usr/local/lib/php/extensions'

Compile extension

For example, I compile swoole extension with these steps.

  • Download swoole-2.1.1.tgz from pecl.php.net
  • Unzip the file and compile the extension
tar xzvf swoole-2.1.1.tgz
cd swoole-2.1.1
phpize
./configure
make
make install
Categories
php

在macOS下用homebrew安装php 7.1以及pecl

用homebrew默认安装的php 7.1没有包含pecl命令。但是重新安装可以解决这个问题,如果出现libpng不兼容问题,可以加上-s参数

brew remove php71
brew install php71 --with-pear