How to run Eclipse MAT (Memory Analyzer Tool) on Mac OS
Hi! In this article, I would like to describe the issue I faced with running Eclipse’s MAT (Memory Analyzer Tool) on Mac OS. I’m using macOS Catalina (version 10.15.4).
Download MAT
I’ve downloaded MAT from the official page - https://www.eclipse.org/mat/downloads.php , and unpacked downloaded ZIP archive. At first, I couldn’t open the application because of the following warning:
If You see the same warning, instead of clicking LMB twice, click RMB once, and choose Open.
Problem — An error has occurred
Oops! That does not look good. Let’s see what the error was. In terminal go to the directory under displayed path and list files:
Open .log file in your favourite editor (which is VIM of course) or in something more syntax-highlighting friendly (like VS Code) and check what the error is:
The important part is:
!MESSAGE Application error!STACK 1java.lang.IllegalStateException: The platform metadata area could not be written: /private/var/folders/4s/25st9pj97wdf_shk56n0_d580000gn/T/AppTranslocation/D48A03D7-A7B4–40BC-9E95–8E9329E428E4/d/mat.app/Contents/MacOS/workspace/.metadata. By default the platform writes its content under the current working directory when the platform is launched. Use the -data parameter to specify a different content area for the platform.
Solution
After a little bit of stackoverflowing I found a solution in one of the responses from this question How to run Eclipse memory analyzer on Mac os?
- Create a directory for MAT workspace:
mkdir /Users/aleksanderkolata/mat_workspace
2. Move MAT to applications directory:
mv ~/Downloads/mat.app ~/Applications/
3. Update MAT initial settings by providing workspace path:
Go to MAT application directory and find MemoryAnalyzer.ini file
cd ~/Applications/mat.app/Contents/Eclipse
Add the following lines to MemoryAnalyzer.ini:
-data
/Users/aleksanderkolata/mat_workspace
In my case the whole file has the following content:
-startup../Eclipse/plugins/org.eclipse.equinox.launcher_1.5.0.v20180512–1130.jar— launcher.library../Eclipse/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.700.v20180518–1200-data/Users/aleksanderkolata/mat_workspace-vmargs-Xmx1024m-Dorg.eclipse.swt.internal.carbon.smallFonts-XstartOnFirstThread
Voila !
Now You can type “mat.app” in Spotlight Search, and application should open without any errors :)