Skip to content

IntelliJ: Change the default cache location (e.g. .IntelliJIdeaXX)

September 30th, 2014 - Software(1 min)

Everything started from a problem I had with PyCharm, where it would create a “.PyCharm30” directory in my home, which would end up being about 300Mb, with a lot of files (2000+files, approx 200 directories). This gets taxed since my home dire gets synced at login/logout with a networked drive.

Fortunately, there’s a way to change this default location to a non-backed-up place (e.g. I have in my home a no-backup directory which is passed over on sync).

Steps are as follows:

  1. Locate the place where you’ve installed you AS (e.g. C:\Program Files\Android Studio)

  2. Go to the bin directory and edit idea.properties file

  3. Search for idea.config.path and idea.system.path and edit those. I ended up having something like:

    #---------------------------------------------------------------------
    #
    idea.config.path=${user.home}/no-backup/.IntelliJIdea/config
    
    idea.system.path=${user.home}/no-backup/.IntelliJIdea/system
    #
    #---------------------------------------------------------------------

    Make sure to uncomment the lines, otherwise you’ll end up with AS recreating the directory in your home.

  4. It’s advisable to keep \${user.home} as directory, because AS will create (or update) the directory for each user!

Things to note:

  • Apparently, according to this, you need to copy the file into your home directory if you’re on a mac :(

  • According to this, the (default) format for folders is:

    # Windows Vista or higher
    #
    <SYSTEM DRIVE>\Users\<USER ACCOUNT NAME>\.<PRODUCT><VERSION>
    
    # Windows XP
    #
    <SYSTEM DRIVE>\Documents and Settings\<USER ACCOUNT NAME>\.<PRODUCT><VERSION>
    
    # Unix-based OS
    #
    
    ${HOME}/.<PRODUCT><VERSION>

Please remember that you have \${user.home} at your disposal to refer to a user’s home directory from the configuration file itself.

HTH,

Share on
Reddit
Linked in
Whatsapp

A little experiment: