Limit Dropbox and others on macOS from taking 100% CPU

Stephen Richardson
3 min readFeb 5, 2017

--

Hot laptop, slow apps, loud fan. What is the cause? Dropbox doing a large file sync task and taking 100% CPU. Here is a simple fix for this situation and other apps doing similar. Install a small software that allows you to limit any running process to a specific max percentage that you define.

— Update Feb 2019 —
Currently cputhrottle is not on Homebrew any longer, you can download it directly from this link:

Unzip it, then in a terminal, make it executable

chmod +x ./cputhrottle

Skip to the after install steps below —

If you don’t have Homebrew for macOS, install it. Paste this as one line into terminal and run it. It’s just a package manager.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Update Homebrew afterward.

brew update

Install cputhrottle. This is the tool that will allow you to limit the CPU usage for a process.

brew install cputhrottle

After installing cputhrottle, start Dropbox or any app that you would like to limit the CPU. Identify the process ID by opening Activity Monitor. You can see the column ‘PID’, this is the ID you want.

PID Column, you can see Dropbox (PID 7988) running just below 60%, instead of the normal 99%.

After you have the PID, in terminal type the below to limit Dropbox to 60% max CPU usage. Press enter, enter your mac password to complete.

sudo cputhrottle 7988 60

Sudo is required so that the app has permission to modify the system process. Check Activity Monitor and you should see Dropbox immediately clock down to 60% or less.

Update 3/8/2018

To avoid having to manually lookup the PID, and to run the cputhrottle process in the background, use the following:

sudo cputhrottle $(pgrep -f Dropbox) 60 &
  1. The & symbol tells the process to run in the background, 60 is the cpu % limit.
  2. `$(pgrep -f Dropbox)` returns the output of pgrep which is the PID. You can run it alone to check the output. It will return a list of numbers, since there are usually more than one Dropbox processes running. But the first one has the lowest PID and is the one causing CPU usage issues.

You can save the above command to limit_dropbox.sh, open a terminal and type:

  1. Create a text file called limit_dropbox.sh and save it in your mac user profile directory ( /Users/[username] or ~/ )
  2. Paste this code (notice it’s missing sudo) and save
cputhrottle $(pgrep -f Dropbox) 60 &

3. Then when you need to limit dropbox, open a terminal and type:

sudo bash ./limit_dropbox.sh# orsudo bash ~/limit_dropbox.sh

4. If you started multiple cputhrottle processes accidentally or would like to stop cputhrottle for any reason, you can use pkill . This will kill all active cputhrottle processes. You can verify the results in Activity Monitor.

sudo pkill cputhrottle

--

--