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

Mysql ibtmp1 taking too much space: solutions

I recently had one of my AWS instances running out of disk space. Mysql server (version 14.14, running a few hundred Mb single databae) created a temporary file of over 11Gb at the path /var/lib/mysql/ibtmp1 and saturated the 16GB disk.

I solved that with this setting

innodb_temp_data_file_path = ibtmp1:100M:autoextend:max:1G

And also the following command, that sets fast shutdown, stops mysql, deletes that temp file, and start mysql again

mysql -u root -e "SET GLOBAL innodb_fast_shutdown = 0;"; 
service mysql stop; 
rm /var/lib/mysql/ibtmp1; 
service mysql start

If you use ansible, you can just have this task

- name: mysql custom config
    src: files/mysqld-custom.cnf
    dest: /etc/mysql/mysql.conf.d/mysqld-custom.cnf
    mode: "744"

where files/mysqld-custom.cnf contains the following


# limits /var/lib/mysql/ibtmp1 to 100Mb-1GB
innodb_temp_data_file_path = ibtmp1:100M:autoextend:max:1G