How to build RyzenAdj for macOS (UPDATED through Ventura?)
- Monitoring functions like
./ryzenadj --info
not working- adjustment only
- cmake (via Homebrew)
- disable SIP (theoretically only CSR_ALLOW_KERNEL_DEBUGGER is required as per https://www.insanelymac.com/forum/topic/346408-hwtools-for-mavericks-and-better-directhw-for-macos-big-sur-superiotool-mptable-osxpmem-iwleeprom-ectool-msrtool-ifdtool-inteltool-nvramtool-pciutils-370-and-flashrom-12/ through Catalina, but 0x8 was not enoug on Monterey).
- macOS Monterey 12.4
- Xcode 13.4.1 (to build DirectHW)
https://github.com/newperson1746/directhw It is possible that DirectHW is not even needed, because this new pciutils includes several other access methods RyzenAdj works with darwin2 (AppleACPIPlatformExpert) method, doesnt require DIrectHW
Download Artifacts from actions to get binaries
# using prebuilt binaries
mkdir -p /tmp/include/DirectHW
cp Artifacts/usr/local/include/DirectHW.h /tmp/include/DirectHW
cp Artifacts/libDirectHW.a /tmp/include
cp -r Artifacts/DirectHW.kext /path/to/EFI/OC/Kexts/
Build your own (Xcode required)
git clone <path-to-directhw-repo>
sed -i -e 's/Apple Development/-/' DirectHW/DirectHW.xcodeproj/project.pbxproj
make build
cp build/Release/libDirectHW.a /tmp/include
cp -r build/Release/DirectHW.kext /path/to/EFI/OC/Kexts/
https://github.com/joevt/pciutils pciutils/pciutils#111 (comment) (documentation on new pciutils for darwin)
git clone <repo>
cd pciutils
sed -i -e 's/Frameworks/Frameworks -I\/tmp\/include/' Makefile
sed -i -e 's/usr\/local\/lib/tmp\/include/' lib/configure
make
mkdir -p /tmp/include/pci
cp lib/*.h /tmp/include/pci
cp lib/libpci.a /tmp/include
https://github.com/FlyGoat/RyzenAdj
git clone https://github.com/FlyGoat/RyzenAdj.git
cd RyzenAdj
# anywhere in CMakeLists.txt, but at top best, add
set(CMAKE_VERBOSE_MAKEFILE ON)
sed -i -e 's/${INC_DIR}/\/tmp\/include/' CMakeLists.txt
sed -i -e 's/${OS_LINK_DIR}/\/tmp\/include/' CMakeLists.txt
# modify set(OS_LINK_LIBRARY pci/) to
set (OS_LINK_LIBRARY pci ZLIB::ZLIB)
# above that line, insert line
find_package(ZLIB REQUIRED)
mkdir build && cd build
cmake ..
make
# build will fail, copy and paste the final link command (starts with /Library/Developer.../cc) and append to it:
-framework IOKit
# now it will build
Pardon the horrible IOKit linking hack, using frameworks in CMake is dog shit
- Add
DirectHW.kext
to config.plist - Add
debug=0x144
(or 0x44) boot-args to config.plist
sudo ./ryzenadj --tctl-temp=70
sudo mkdir -p /usr/local/bin
sudo cp ./ryzenadj /usr/local/bin
sudo cp org.b00t0x.ryzenadj.plist /Library/LaunchDaemons/
sudo chmod 644 /Library/LaunchDaemons/org.b00t0x.ryzenadj.plist
sudo chown 0:0 /Library/LaunchDaemons/org.b00t0x.ryzenadj.plist
sudo launchctl load /Library/LaunchDaemons/org.b00t0x.ryzenadj.plist