Enable early access Metal support for JetBrains IDEs

JetBrains probably has some of the best IDEs out there. However, if you've ever used one for more than two minutes, you'll know it's not their speed that puts them on the leaderboards. To be fair, I've seen a lot of improvements in the last two years. Specifically project load times and indexing has been cut down a lot for me.

There's just one issue that most of my colleagues and I have been struggling with from the start: using PhpStorm on a none-native resolution on a 4K display. Native 1080p or 4K are okay-ish, anything inbetween is unbearable. Simple tasks like scrolling around or simply typing can slow the UI down to just a couple of updates per second. Just take a look at this issue for more info.

Project Lanai is a joint effort between JetBrains and Oracle that looks to solve this by utilizing Apple's Metal API for rendering the application instead of OpenGL. More info can be found on the wiki.

TL;DR: better performance for JetBrains IDEs on MacOS 👌

Enabling EA Metal support for any JetBrains IDE

  1. Get the latest early access JDK with Metal support from the wiki
  2. Extract the .tar.gz file and take note of the path of the extracted jdk-15.jdk file
  3. Go to ~/Library/Application Support/JetBrains/ and open the relevant product directory (e.g. PhpStorm2020.1)
  4. Make a backup of the .jdk file (e.g. phpstorm.jdk)
  5. Update the contents of the .jdk file with the EA JDK path from step 1
  6. Open the IDE, this should still work without issues
  7. Edit the VM options using "Help" > "Edit custom VM options"
  8. Add the following line to the end of the file to enable Metal support: 
    -Dsun.java2d.metal=true

That's it! Restart PhpStorm and pray everything still works. This JDK is still a pretty early access build so your mileage may vary. For example, at the time of writing the preferences pane is disabled when using the Metal pipeline.