Automatic CPU speed & power optimizer for Linux. Actively monitors laptop battery state, CPU usage, CPU temperature, and system load, ultimately allowing you to improve battery life without making any compromises.
For tl;dr folks:
Youtube: auto-cpufreq v2.0 release & demo of all available features and options
Youtube: auto-cpufreq - tool demo
If you're having a problem with auto-cpufreq, before (submitting an issue), it is strongly recommended to use the auto-cpufreq-genAI-chatbot to get an immediate answer to your question.
Example of auto-cpufreq GUI (available >= v2.0)
Example of auto-cpufreq --stats CLI output
--force governor override--turbo mode overrideOne of the problems with Linux today on laptops is that the CPU will run in an unoptimized manner which will negatively impact battery life. For example, the CPU may run using the "performance" governor with turbo boost enabled regardless of whether it's plugged into a power outlet or not.
These issues can be mitigated by using tools like indicator-cpufreq or cpufreq, but those still require manual action from your side which can be daunting and cumbersome.
Tools like TLP (which I used for numerous years) can help extend battery life, but may also create their own set of problems, such as losing turbo boost.
Given all of the above, I needed a simple tool that would automatically make CPU frequency-related changes and save battery life, but let the Linux kernel do most of the heavy lifting. That's how auto-cpufreq was born.
Please note: auto-cpufreq aims to replace TLP in terms of functionality, so after you install auto-cpufreq it's recommended to remove TLP. Using both for the same functionality (i.e., to set CPU frequencies) will lead to unwanted results like overheating. Hence, only use both tools in tandem if you know what you're doing.
One tool/daemon that does not conflict with auto-cpufreq in any way, and is even recommended to have running alongside, is thermald.
Only devices with an Intel, AMD, or ARM CPU are supported. This tool was developed to improve performance and battery life on laptops, but running it on desktops/servers (to lower power consumption) should also be possible.
As auto-cpufreq relies on git based versioning, users are advised to install
auto-cpufrequsinggit clonemethod only. Downloading source code as a zip/from release will emit build error like these.
Get source code, run installer, and follow on-screen instructions:
git clone https://github.com/AdnanHodzic/auto-cpufreq.git
cd auto-cpufreq && sudo ./auto-cpufreq-installer
Please note: while all auto-cpufreq >= v2.0 CLI functionality will work as intended, the GUI won't be available on Snap package installs due to Snap package confinement limitations. Hence, please consider installing auto-cpufreq using auto-cpufreq-installer.
auto-cpufreq is available on the Snap Store or via CLI:
sudo snap install auto-cpufreq
Please note:
- Make sure snapd is installed and snap version is >= 2.44 for auto-cpufreq to fully work due to recent snapd changes.
cgroups v2 being in development. This problem can be resolved by either running sudo snap run auto-cpufreq after the snap installation or by using the auto-cpufreq-installer which doesn't have this issue.The AUR Release Package is currently being maintained by MusicalArtist12, liljaylj, and parmjotsinghrobot.
Notices
/usr/share/ instead of /usr/local/share/# systemctl enable --now auto-cpufreq
sudo systemctl mask power-profiles-daemon.service (then enable and start the auto-cpufreq.service if you haven't already).New versions of auto-cpufreq were recently added to GURU, Gentoo's official community-maintained ebuild repository. The ebuild is maintaned by S41G0N and other GURU contributors, who can respond in case of issues.
In order to build auto-cpufreq, it is necessary to add & sync GURU repository first. Adding ~amd64 keyword is also needed to unmask the package.
# echo "sys-power/auto-cpufreq ~amd64" >> /etc/portage/package.accept_keywords
# eselect repository enable guru
# emaint sync -r guru
# emerge --ask auto-cpufreq
Notices
/usr/share/ instead of /usr/local/share/# systemctl enable --now auto-cpufreq
# rc-update add auto-cpufreq default && rc-service auto-cpufreq start
Flakes
This repo contains a flake that exposes a NixOS Module that manages and offers options for auto-cpufreq. To use it, add the flake as an input to your flake.nix file and enable the module:
# flake.nix
{
inputs = {
# ---Snip---
auto-cpufreq = {
url = "github:AdnanHodzic/auto-cpufreq";
inputs.nixpkgs.follows = "nixpkgs";
};
# ---Snip---
}
outputs = {nixpkgs, auto-cpufreq, ...} @ inputs: {
nixosConfigurations.HOSTNAME = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
./configuration.nix
auto-cpufreq.nixosModules.default
];
};
}
}
Then you can enable the program in your configuration.nix file:
# configuration.nix
{inputs, pkgs, ...}: {
# ---Snip---
programs.auto-cpufreq.enable = true;
# optionally, you can configure your auto-cpufreq settings, if you have any
programs.auto-cpufreq.settings = {
charger = {
governor = "performance";
turbo = "auto";
};
battery = {
governor = "powersave";
turbo = "auto";
};
};
# ---Snip---
}
Nixpkgs
There is a nixpkg available, but it is more prone to being outdated, whereas the flake pulls from the latest commit. You can install it in your configuration.nix and enable the system service:
# configuration.nix
# ---Snip---
environment.systemPackages = with pkgs; [
auto-cpufreq
];
services.auto-cpufreq.enable = true;
# ---Snip---
If you have poetry installed:
bash
git clone https://github.com/AdnanHodzic/auto-cpufreq.git
cd auto-cpufreq
poetry install
poetry run auto-cpufreq --help
Alternatively, we can use an editable pip install for development purposes:
bash
git clone https://github.com/AdnanHodzic/auto-cpufreq.git
cd auto-cpufreq
# set up virtual environment (details removed for brevity)
pip3 install -e .
auto-cpufreq
poetry update if you get any inconsistent lock file issues.After installation, auto-cpufreq is available as a binary. Refer to auto-cpufreq modes and options for detailed information on how to run and configure auto-cpufreq.
auto-cpufreq makes all decisions automatically based on various factors such as CPU usage, temperature, and system load. However, it's possible to perform additional configurations:
When installing auto-cpufreq via [auto-cpufreq-i
$ claude mcp add auto-cpufreq \
-- python -m otcore.mcp_server <graph>