Friday, May 15, 2020

Running a macbook without battery ... let's go:


Please Note - Aug/2024: 

This is probably now completely outdated and I am not maintaining any part of it, use at your own risk.


A pandemic: 


During the covid-19 lockdown, like many others, I've used my Macbook 13' mid-2018, quite a lot. And big mistake... it was always plugged in. Was it the cause of the problem or just a faulty battery, we will probably never know, but the battery started swelling badly to the point where it started deforming the case.



As I was using this laptop for my work and on time sensitive projects, no replacement battery available to do it myself, I had to find a solution. Apple was not helping, as they refuse to sell you parts, even in the middle of a lockdown, when you rely on your mac for work, and you cannot leave it 3 to 5 days in the hands of their technical service.

***Please note***: this is probably completely outdated by now, it was originally published in May 2020

Before removing:

First thing to know, the macbook will boot, but Apple decided to limit CPU performances to the bare minimum when running without battery. Some of the things you may need to do, may takes ages to load if they even load.

That's why I think, it is more efficient to do a couple of actions before removing the battery.

  1. Deactivating kernel_task capability to slow down your computer
  • Boot into recovery mode (press command+R at boot) 
  • Open a terminal
  • Deactivate SIP: csrutil disable (keep this disabled as it will be important for restoring normal CPU speeds after)
  • In single mode (command+S)
  • do a backup copy of /System/Library/Extensions/IOPlatformPluginFamily.kext
    • for example:
    • rsync -av /System/Library/Extensions/IOPlatformPluginFamily.kext /Users/Shared/
  • remove the IOPlatformPluginFamily: 
    • sudo rm -rf /System/Library/Extensions/IOPlatformPluginFamily.kext
    • if your system is read only, just do a mount -uw /  and redo the command above
  • Note: you should be able to reactivate csrutil with the following command and still be able to load CPUTune:
    • in recovery mode again:
    • csrutil enable --without kext
  • reboot, download and compile (with XCode)

  If you are having trouble compiling (here are the instructions from Nick-Z0, Thank you!)

Hello everyone, I am also trying to run my macbook without a battery following the tutorial by @christophe-duc in the first post but after spending the whole day on it without any luck, I finally managed to do it on my last try before posting here and asking for a compiled version. I just want to share what helped me to spare other people some time.

I was unable to compile it. I am on MacOS 10.14.6, I had xcode 11.0 that did not work, tried to install SDK for 10.14 as per a commenter on the tutorial post, did not work, installed xcode 10.3 tried again but did not work either (always changing deployment info to 10.14).

In the end I after searching the errors I got, I found this answer on stackoverflow that opening .xcodeproj instead of .xcworkspace will cause some errors. I was trying to compile CPUTuneApp and CPUTuneCore separately, only managing to compile the latter with success.

So the proper way to compile it is:

  1. Use correct version of Xcode that has SDK for your OS.
  2. Open ONLY CPUTune.xworkspace
  3. Change deployment to match your OS (click blue icon on the left CPUTuneCore, select Build Settings, Levels, and then set everything in macOS Deployment target to your OS. Then on the second list directly left of the Deployment target, select the other files and also change Deployment target. Finally, select the other blue icon CPUTuneApp and repeat the steps to change deployment target for everything.
  4. Click Play icon/Compile and hopefully you will get build succeeded message.

After removing:

Boot normally your macbook (it is going to be a very slow boot as the processor is going to be forced by Apple to run at the lowest speed possible)

How Apple is doing this, is by setting the BD_PROCHOT signal on the Intel CPU, which indicates that the CPUs are running hot (but they are not!) and disabling frequency stepping.

Disabling BD_PROCHOT is done at your own risk, as you are effectively disabling the thermal protections of your CPUs

CPUTune will solve this for you:
  • It will deactivate the turboboost (recommended so you don't overheat your CPUs) 
    • Note: it should be possible to run with turboboost as BD_PROCHOT does not impact the capabilities of the CPU to send its own PROCHOT signal and cool down when needed. So far my tests all get a forced reset when I deactivate BD_PROCHOT and Turboboost is enable. If you experience something different please let me know in the comment or post on CPUTune github. So far I think it's just Apple screwing with us, there should be a way to restore normal functionalities even without a battery...
  • Deactivate the BD_PROCHOT signal
  • Reactivate frequency stepping if needed
Once compiled, XCode will provide the CPUTune package in the Product directory in the XCode project interface. You can use 'Show in Finder' to copy the package into a directory of your choice.

  • change ownership on the package:
    • sudo chown -R root:wheel CPUTune.kext
  • Load the kext into memory (remember csrutil should be set to disable for this to work, as the kext is not signed)
    • sudo kextutil -v CPUTune.kext
  • kextutil will show an error that the kext is unsigned, but it should load it anyway if csrutil is disabled, you can then check if it's loaded using
    • kextstat
  • You can also check in /var/log/cputune.kext.log
CPUTune @ CPUInfo: cpu model: 0x8e
CPUTune @ cpu-tune-panic not existed in NVRAM property
CPUTune @ CPUInfo: cpu model: 0x8e
CPUTune @ init: successed!
CPUTune @ disableTurboBoost: change 0x850089 to 0x4000850089 in MSR_IA32_MISC_ENABLE(0x1a0)
CPUTune @ disableProcHot: change 0x64005f to 0x64005e in MSR_IA32_POWERCTL(0x1fc)
CPUTune @ enableSpeedShift: change 0x0 to 0x1 in MSR_IA32_PM_ENABLE(0x770)
CPUTune @ start: RegisterService

And voila! Your CPUs should now be freely moving frequency between min and max and you should have restored usability to your mac.

If you want to have CPUTune activated automatically at boot, just copy CPUTune.kext to /Library/Extensions/. Don't forget to make sure that the owner is correctly set:

sudo chown -R root:wheel /Library/Extensions/CPUTune.kext

Tested on May 2020 with a macbook pro 13' mid-2018 and running Catalina.

Additional note: if you are noticing shutdowns when high CPU programs are running, it seems that it is caused due to interference from the tailspind and spindump daemon.

You can check this by opening console and looking into the diagnotistic reports and you will see cpu_resource.diag files being generated when the shutdown happened

You can disable those daemons by issuing the following commands:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.tailspind.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.spindump.plist
If you want to permanently remove those services, remove the plist or move it to another name. You might need to boot into single user-mode for that (Command+S at boot) and remount the file system in read-write with mount -uw /

After disabling those, I have been able to use my macbook pro even on CPU intensive tasks without any issues. 

Additional note 2: if you want to restore Fans to normal behavior you can use Macs Fan Control it is available here: https://crystalidea.com/macs-fan-control/download

38 comments:

  1. I'm facing a similar problem (cpu throttling) but with the battery connected.
    Already cleaned coolers and replaced thermal paste.
    Temperature does not seem to be the problem.
    This is a MacBook Pro Retina 13inch from Late 2012 running Catalina.
    Any possible suggestions?

    Obrigado

    ReplyDelete
  2. You might want to try AppleIntelInfo.kext to try to see what's happening in the CPU MSRs'.

    Nada, um prazer.

    ReplyDelete
  3. Oi, Cristophe, tudo bem? Em primeiro lugar, agradeço a sua tentativa de resolver esse problema! Vou escrever em inglês a minha dúvida, para manter a linguagem do blog :)

    I've tried to load your kext and I'm not sure it's working here on my mac. I'm not a programmer, no previous interaction at all with Xcode, so I'm a bit lost.

    I think I managed to do everything you said in your tutorial. First, I tried using your compiled kext, but it displays this error: "(libkern/kext) link error" and "(kernel) Failed to load kext org.syscl.driver.CPUTune (error 0xdc008016)".

    So I tried compiling the current version of CPU Tune (available in Github) through Xcode and I think I made it. Xcode alerts 203 issues with it, but it does generate the file "CPUTuneCore.kext", so... I guess I built it?

    Then I'm able to load the kext using kextutil, after changing the ownership. I can see that the kext is loaded with kextstat.

    However, my CPU is still limited to 1.1 Ghz... :(

    Do you know what might be happening?

    I'm using Xcode 8.3, with MacOS Sierra 10.12.6.

    Once again, thanks for your effort. My mac is so slow right now and the new battery will only arrive here in Brazil in a month or so, it would be really nice if I can make it a bit more bearable until then.

    ReplyDelete
    Replies
    1. Hi Gabriel,

      Try to change Deployment Target:
      - Open this with Xcode
      - Navigate into the folders and select CPUTuneCore
      - In the middle of screen shows some information, go to Deployment Info and change for 10.12
      - Do the same for CPUTuneApp file

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Thanks for the explanation. It works great! I just have a little bit inconvenient. I copied the Kext to /Library/Extension/ but when the mac wakes up the kext is not working anymore then I have to run in terminal kextunload and kextload for CPUTune again, do you know how I can do that automatically? Because when I restart de OS X, works perfectly.

    Thanks!

    ReplyDelete
  6. Hi, thanks for sharing your guide. I am having problems understanding how to set the owner? I have copied the next in library extension but what is the line u could use for the terminal? Thanks again, Luigi

    ReplyDelete
  7. you have saved me, and this beautiful 2011 mbp. Now it is usable @2.20 ghz without a battery even installed.

    ReplyDelete
  8. Wow amazing, my 2011 MBP is stuck at 800mhz and have been using it in windows only because of throttle stop does the job properly.
    Apple definitely does this on purpose so they make warranty money and people stop buying 3rd party batteries. Its a win win for them. Glad there is a solution for OSX!

    ReplyDelete
  9. Thank you for very detailed solution. However got error when loading the kext into memory.


    Defaulting to kernel file '/System/Library/Kernels/kernel'
    Kext with invalid signatured (-67050) allowed: { URL = "file:///System/Library/Extensions/CPUTune.kext/", ID = "org.syscl.driver.CPUTune" }
    Code Signing Failure: code signature is invalid
    /System/Library/Extensions/CPUTune.kext appears to be loadable (not including linkage for on-disk libraries).
    Loading /System/Library/Extensions/CPUTune.kext.
    Disabling KextAudit: SIP is off
    KextAudit initialized: audit=F
    (kernel) kxld[org.syscl.driver.CPUTune]: The super class vtable '__ZTV9IOService' for vtable '__ZTV7CPUTune' is out of date. Make sure your kext has been built against the correct headers.
    (kernel) Can't load kext org.syscl.driver.CPUTune - link failed.
    (kernel) Failed to load executable for kext org.syscl.driver.CPUTune.
    (kernel) Kext org.syscl.driver.CPUTune failed to load (0xdc008016).
    (kernel) Failed to load kext org.syscl.driver.CPUTune (error 0xdc008016).
    Failed to load /System/Library/Extensions/CPUTune.kext - (libkern/kext) link error.
    Failed to load /System/Library/Extensions/CPUTune.kext - (libkern/kext) link error.
    Check library declarations for your kext with kextlibs(8).


    I'm using compiled binary, mac OS 10.14.6, MacBook Air 5,2 (13-inch, Mid 2012). Also csrutil comand with --without kext assertion didn't work, but might be unrelated.

    I'm completely newbie and sorry for unusual English.

    ReplyDelete
    Replies
    1. Hi, I think you might need to recompile the code for your mac os version

      Delete
    2. Hi, What I did was to download xcode 10.3 which has the sdks for MAc OS 10.14.6, then I recompile cputunecore making sure the deployment target is 10.14. Then i copied the cputunecore.kext to the root folder (Macintosh HDD). From there, I ran the code: sudo chown -R root:wheel /Library/Extensions/CPUTune.kext

      then i ran the second code: sudo kextutil -v CPUTune.kext

      lastly i checked with kextstat and viola it loaded and is working now.

      Delete
  10. Hey there, it gives me the same problem.

    Here's what I did:

    Go into recovery and disable SIP using csrutil disable
    Go into single mode and deleting IOPlatformPluginFamily.kext
    Go into recovery and activate SIP excluding kexts using kextutil enable - - without kext


    After this, I change the ownership of CPUTune kext and I try to load it. The problem is not really the invalid signature, but the mac just shuts down and it refuses to install the package.

    I read about using -cputbeta but not sure where I should add it.

    ReplyDelete
  11. I think you might need to re-compile the code

    ReplyDelete
  12. First, thank you Christopher for this article. You’ve no idea how much my life could be lifted off from standstill, given the COVID restrictions, if I become successful in recreating ThrottleStop like behaviour to disable BD PROCHOT and scale CPU multiplier in MacOS environment.

    To begin with I’ve one question: can I use another machine to compile CPUTune in Xcode (for a given target version 10.5.x) and then used that build on another machine that runs on 10.5.x? Or I need to compile and build CPUTune binary on the machine hardware that it’s gonna end up being tuned for?

    ReplyDelete
  13. At first i'd like to say thanks to this handsome,clever and amazing dude who created this guide!
    Man you are cool!

    Now my little case and upd to this guide:
    I have MacbookPro 2013 Early 13' running on I5 2,6 GHZ (BD PROCHOT sets it on 1.1)

    I did everything like it was in guide , but Cputonecore upgraded and now this kext file is called Cputonecore.kext

    I had an issue with coping of it in /Library/Extensions because of read-only mode of this folder,as i understand they made /system in read-only mode even if csrutil is disabled.

    Here is the solution:
    sudo mount -uw /
    killall Finder

    https://www.reddit.com/r/MacOS/comments/caiue5/macos_catalina_readonly_file_system_with_sip/

    Kext is works on autoload,but it turns of if Mac is in sleep mode for 15-30 min+..

    If you have a solution please write it here!)

    ReplyDelete
    Replies
    1. Same. In my case, it occurs rarely, but unrelated to the length of sleep. Checking kextstat shows the kext is still loaded, but somehow frequency is dropped to 0.8 GHz again.
      According to GitHub page of CPUTune, entering "echo 1>/tmp/CPUTuneProcHotRT.conf" into the terminal solved the problem for me.
      Might be better to directly modify Info.plist inside of CPUTunecore.kext but haven't tried myself. Hope it helps.

      Delete
  14. Hello, Thankyou for your nice post
    i follow your intruction but there are a problem.. i was removed spindump and tailspind but why my macbook suddenly shut off when doing intensive task?

    im using MBP Mid 2012 with Catalina 10.5.7.
    thankyou, have a great day!

    ReplyDelete
    Replies
    1. I think this is due to the fact that with an intensive task, the processor is too hot

      Delete
  15. Hi, I just want to say a big THANK YOU, the kext and the instructions worked perfectly in my Macbook 13” early 2011 (High Sierra 10.13.6, xCode 9.4.1). The computer had a swollen battery so I removed it and the CPU was working at minimum speed (800 MHz), after compiling and loading the kext now my mac works as intended (2.3 GHz) without the need for a battery. I performed stress-tests several times (with Macs fan control loaded at login) and the processor just reach 88-90º C at max load (multicore), there was no need to remove tailspind and spindump daemons. Computer works flawlessly and took a new breath, no need to upgrade to a newer model yet. Do you accept donations? I’d like to make a small one. Again THANKS!

    ReplyDelete
    Replies
    1. Thanks a lot Carlos, glad it could help. If you feel like it you can donate to my favorite non-profit (or yours) and everything is cool! Mine is SeaShepherd.

      Delete
  16. This comment has been removed by the author.

    ReplyDelete
  17. If anyone has problems compiling, you should check the issues on GitHub. Here I posted what worked for me after spending a whole day trying to make this work.

    https://github.com/syscl/CPUTune/issues/4#issuecomment-869146300

    Thanks a lot Christophe for making my macbook usable again!

    ReplyDelete
  18. Espectacular !

    Thank you Christophe for this great solution and thank you Nick for the detailed compiling explanation.
    Faced the same problem in the last few days on my MacBook Pro 11,1 (Retina, 13-inch, Late 2013), running High Sierra 10.13.6.
    So, I've done everything as you said but got no CPUTune.kext after compiling on XCode. Retried a couple of times, double checking every single point and still didn't got it. Then I tried to go on using CPUTuneCore.kext and it seems my Mac got suddenly back to normal.
    Now I just have a noob question: how do I check if my CPU is running full speed now ?
    Thanks a lot !

    ReplyDelete
    Replies
    1. One solution could be to run a benchmark app like Geekbench 5
      They have a normal performance value for most of the available system variants that you can compare your actual results to

      Delete
  19. couldn't remove the IOPlatformPluginFamily in Bigsur

    ReplyDelete
  20. Hi, first of all thank you for this "mac" saver.
    so heres my problem, i found out the hard way why you shouldnt remove the battery, and as so i only did the tutorial after the remove bat part, and it worked! but couple days later, still mesmerized by the idea of having my mac back, i went and install some new software, forgot to keep an eye on the temperature and thermal kicked in, the first reboot i was all good, except for an over-consuming task, another reboot, and the mac was slow again... it doesnt matter what i do, i cant make it good again, maybe some file that i need to remover that i dont know, or something.... help! :D

    ReplyDelete
  21. This comment has been removed by the author.

    ReplyDelete
  22. With the updated version of Mac OSX to 12.4 is sort of break something. I am not sure what but I have followed every step but cant seems to get it to work anymore. Do you have a video to show the step in case anything I did was missed out?

    ReplyDelete
  23. how do you fix throttle on Macbook running window only :(

    ReplyDelete
  24. Helo, A have Macbook Pro Mid 2010, High Sierra 10.13.6, Xcode 10.1, I downloaded and compiled from GitHub CpuTune, but I haven't CpuTune.kext , I have only CpuTuneCore.kexp. Is this same ??? Compile ran successfully and finally when I ran
    sudo kextutil -v CPUTuneCore.kext my Mac reset with error.
    What wrong am I doing ? Please help

    ReplyDelete
  25. here's my experience on a 2012 Macbook Air on Catalina 10.15.7:

    CPUTune definitely works, just compile it yourself. I used Xcode 11.7. you can download it from xcodereleases.com

    my issue occurred after a security update to 10.15.7 recently. CPUTune was still running fine but the CPU started throttling again. turns out the updated replaced my deleted IOPlatformPluginFamily.kext and after I removed IOPlatformPluginFamily.kext it started working again. so it seems like IOPlatformPluginFamily.kext will prevent CPUTune from working at least on my machine.

    So headsup to everyone hitting a wall. try removing IOPlatformPluginFamily.kext, CPUTune should work now!

    btw big thanks to Christophe and the CPUTune team. gave my old Macbook Air a new least of life! 🙏🏼

    ReplyDelete
  26. Are there special instructions for a Opencore-booted MacBook? Using MBP 10,1 (mid-2013) and running 13.2 Ventura

    ReplyDelete
  27. any solution for linux users?
    I can't find a copy of xcode without developer account (no I won't install macos)

    ReplyDelete
  28. Hey, I’m running a 2017macbook pro with Catalina
    I’ve followed all the instructions on the post, but when I load the kext, it says loaded successfully, but when I try and disable prochot, nothing happens.
    There’s no log file and once I rebuild the kextcache, I can’t login once I reboot…
    I have to go into safe mode and move CPUTuneCore.kext and rebuild the kextcache to log in again…

    Help, please

    ReplyDelete
  29. In OCLP there is an option in settings to disable throttling.

    ReplyDelete