How to change the Android emulator temporary directory

If you'd like the Android emulator to store its temporary files in a directory different from /tmp/android (maybe you're sharing your computer with someone else that needs to run the emulator and you both want to run it at the same time), then there's unfortunately no other way to do it but to change it directly in the emulator binary, since it's hardcoded.

To do that, open up the binary in vim:

vim -b path-to-android-sdk/tools/emulator

Once the file is open, search for the /tmp/android string by typing the following and pressing ENTER:


Now press a, modify the path to whatever you like, as long as it contains the exact same amount of characters (make sure you don't change anything else). After the path is changed, press Esc, then :wq, Enter and start the emulator.