在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

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.

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

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

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

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

brew remove php71
brew install php71 --with-pear