Mac中修改vm参数导致idea无法启动的修复方式
-
在mac中找到Idea的安装位置
我的安装位置在/Applications/IntelliJ IDEA.app/Contents
中 -
找到 MacOS文件夹内的
idea
程序 -
通过终端启动该程序
./idea
-
查看启动日志中的
idea.vmoptions
的位置和错误信息,我的如下2022-11-03 11:51:58.149 idea[10941:21199920] allVms required 1.8*,1.8+ 2022-11-03 11:51:58.155 idea[10941:21199926] Current Directory: /Applications/IntelliJ IDEA.app/Contents/MacOS 2022-11-03 11:51:58.155 idea[10941:21199926] Value of IDEA_VM_OPTIONS is (null) 2022-11-03 11:51:58.155 idea[10941:21199926] Processing VMOptions file at /Users/xxx/Library/Application Support/JetBrains/IntelliJIdea2020.3/idea.vmoptions 2022-11-03 11:51:58.156 idea[10941:21199926] Done OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release. Error occurred during initialization of VM Option -XX:+UseZGC not supported
-
确定文件位置 为
/Users/xxx/Library/Application Support/JetBrains/IntelliJIdea2020.3/idea.vmoptions
-
确定我的原因如下,
Option -XX:+UseZGC not supported
-
修复该错误即可
-Xms1024m -Xmx1024m -XX:ReservedCodeCacheSize=256m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -XX:CICompilerCount=2 -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -XX:ZCollectionInterval=120 -XX:ZAllocationSpikeTolerance=5 -XX:+UnlockDiagnosticVMOptions -XX:-ZProactive -ea -Dsun.io.useCanonCaches=false -Djdk.http.auth.tunneling.disabledSchemes="" -Djdk.attach.allowAttachSelf=true -Djdk.module.illegalAccess.silent=true -Dkotlinx.coroutines.debug=off -XX:ErrorFile=$USER_HOME/java_error_in_idea_%p.log -XX:HeapDumpPath=$USER_HOME/java_error_in_idea.hprof