Speed up PHPstorm: cache into a RAM disk (Mac)

With macOs, PHPStorm indexes all your project files and write cache files into files under


Thousands of files are stored there. If you want your Mac to use less your hard disk (to extend its life), and also be faster in general, you can create a RAM disk (a virtual disk that uses RAM instead of your disk), and symlink the cache directory there.

I’ve been using this for a while and it seems to work well. The only downside is losing the cache when you restart the IDE, but that takes only a few mins to recreate (and clean automatically), so I’m overall happy with this approach.


Add this script to your ~/.bash_profile

The bash command ramDiskCreate will now create a volume called RAMDiskwith a phpstorm-cache inside it. You need to call this script each time you restart and you need to launch PHPStorm (I don’t often restart, so I didn’t bother to make it automatically launched at start).

The thing left to do (only once) is symlinking the cache directory into the newly created directory (update and test with your path, don’t just copy and paste):

mv ~/Library/Caches/PhpStorm2017.3  /Volumes/RAMDisk/phpstorm-cache
ln -s  /Volumes/RAMDisk/phpstorm-cache ~/Library/Caches/PhpStorm2017.3