Obscure techniques for developers to minimise macOS CPU, disk I/O and power consumption

updated Sat 11 Feb 2017

Me writing this blog post

Assuming you’ve done all the obvious things, e.g.: remove unwanted apps, close apps that don’t need to be open, remove System Preference pane based apps you can do without, tidy the Login Items list, free up sufficient disk space, upgrade RAM, remove unnecessary browser extensions etc.

  • Exclude every website, Git repository and virtual machine on your Mac from Spotlight search.  This made an incredible difference in CPU activity for me (the mdworker and mds processes are what to look for in Activity Monitor).
  • Reduce the quantity of files in your Dropbox folder. It can’t cope with hundreds of thousands of files, or at least the indexing process on initial login can become lengthy and CPU intensive as you near Dropbox’s own estimate of 300,000 files.  Avoid having any Git repositories in there – just make sure you (a) have local backups (Time Machine only backs up certain files and directories) (b) you’re pushing to GitHub, Bitbucket or somewhere else off-site regularly.   Download AWS CLI and sync a .tar.gz occasionally with an S3 bucket.
  • If you use PhpStorm, turn off all the Language Injections you don’t need, turn off all the Inspections you don’t need and remove any unnecessary plugins.  You’ll almost certainly have a handful of candidates for each of those three areas – i.e. languages or frameworks you never use.  Just familiarise yourself with what’s available every now and again so if you do work on an unusual project you have a better chance of remembering to turn the necessary options back on.

(P.S. I’m still using El Capitan 10.11.6 and have no plans to upgrade for several months.)

Mac load average

$ sysctl -n vm.loadavg
{ 1.29 1.38 1.45 }

If you think the Mac load average seems high compared to Linux, here’s an explanation of how it’s calculated.  The CPU idle % is a more useful measure of how loaded your system is (the above measurement was taken with 97% idle CPU).

Keys

First they came for the § key, and I did not speak out –
Because I could never remember what it was for.

Then they came for #, and I did not speak out –
Because you just press opt+3* (and who uses it other than developers?)

Then they came for Delete, and I did not speak out –
Because you could still use Fn + backspace and in any case I had a full size, wired numeric keyboard.

Then they came for F13-F19, and I did not speak out –
Because they were so far away.

Then they came for the full height arrow keys, and I did not speak out –
Because I had mapped up and down to J/K with the Vimium extension.

Then they came for Pg Up/Down, Home & End, and I did not speak out –
Because my full size keyboard still had them and the icons confused me.

Then they came for Escape, and I did not speak out –
Because I could map it to Caps Lock (where it should have been all along) and I wasn’t planning to buy a Macbook anytime soon anyway.

* British layout

Apple launch Safari “Technology Preview”

Equivalent to Chrome Canary and Firefox Developer Edition. Fortnightly updates. Requires 10.11.4 (El Capitan).  New features that interest me:  javascript-based clipboard cut and copy (not paste) and improved Content Security Policy support.

What’s encouraging is this may mean Apple are allocating greater resources to Safari development.

Apple Beta Software enrollment bug fixed

There was a bug where if you wanted to enroll (or possibly just re-enroll) an iPhone into the iOS 9.3 public beta, you’d get as far as Step 2 (Download Profile), and on clicking the blue button the server would hang for 10-15 seconds or so then present you with an error message and an MD5 hash.

They’ve fixed it now. So you can install iOS 9.3 in advance of the Apple event on the 21st (the final version might be the same build — 13E5233a — as the current beta and they might release it on Monday, or they might wait until one week later. Who knows?)  At version 7 it’s looking pretty polished now though.