通过命令行安装 IntelliJ 时的 `GetJREPath()` OSX

`GetJREPath()` when installing IntelliJ via command line OSX

我试图通过 运行 免提安装 Intellj:

wget https://download.jetbrains.com/idea/ideaIC-2017.2.3.dmg
hdiutil mount -nobrowse ideaIC-2017.2.3.dmg
mkdir /Applications/IntelliJ\ IDEA\ CE.app
cp -r /Volumes/IntelliJ\ IDEA\ CE/IntelliJ\ IDEA\ CE.app/ /Applications/IntelliJ\ IDEA\ CE.app/
hdiutil unmount /Volumes/IntelliJ\ IDEA\ CE/ 
rm ideaIC-2017.2.3.dmg

我在 OSX 上安装时注意到 Intellij.app 文件从 /Volumes/IntelliJ 中的挂载被复制到我的 /Applications 文件夹中的目录中cp,我有错误:

Error: could not find libjava.dylib
Failed to GetJREPath()

当运行执行文件在/Applications/IntelliJ IDEA CE.app/Contents/MacOS.

具体来说,我得到了:

LSOpenURLsWithRole() failed with error -10810 for the file /Applications/IntelliJ IDEA CE.app.

当我尝试:

open /Applications/IntelliJ\ IDEA\ CE.app/

但是当我手动尝试 "drag-and-drop" 来自 Finder window 的应用程序时,其中的 none 出错了。这是怎么回事?

信息:

当我"drag-and-drop"时输出:

./idea 
2017-08-31 18:14:27.258 idea[5098:151348] allVms required 1.8*,1.8+
2017-08-31 18:14:27.260 idea[5098:151359] Value of IDEA_VM_OPTIONS is (null)
2017-08-31 18:14:27.260 idea[5098:151359] fullFileName is: /Applications/IntelliJ IDEA CE.app/Contents/bin/idea.vmoptions
2017-08-31 18:14:27.260 idea[5098:151359] fullFileName exists: /Applications/IntelliJ IDEA CE.app/Contents/bin/idea.vmoptions
2017-08-31 18:14:27.260 idea[5098:151359] Processing VMOptions file at /Applications/IntelliJ IDEA CE.app/Contents/bin/idea.vmoptions
2017-08-31 18:14:27.260 idea[5098:151359] Done
/Applications/IntelliJ IDEA CE.app/Contents/bin/idea.properties: 'java.endorsed.dirs = ' already defined in system properties: /Applications/IntelliJ IDEA CE.app/Contents/jdk/Contents/Home/jre/lib/endorsed

当我 mkdir 然后 cp:

时输出
./idea 
2017-08-31 18:15:56.295 idea[5134:152286] allVms required 1.8*,1.8+
2017-08-31 18:15:56.297 idea[5134:152301] Value of IDEA_VM_OPTIONS is (null)
2017-08-31 18:15:56.297 idea[5134:152301] fullFileName is: /Applications/IntelliJ IDEA CE.app/Contents/bin/idea.vmoptions
2017-08-31 18:15:56.297 idea[5134:152301] fullFileName exists: /Applications/IntelliJ IDEA CE.app/Contents/bin/idea.vmoptions
2017-08-31 18:15:56.297 idea[5134:152301] Processing VMOptions file at /Applications/IntelliJ IDEA CE.app/Contents/bin/idea.vmoptions
2017-08-31 18:15:56.298 idea[5134:152301] Done
Error: could not find libjava.dylib
Failed to GetJREPath()
2017-08-31 18:15:56.298 idea[5134:152301] JNI_CreateJavaVM (/Applications/IntelliJ IDEA CE.app/Contents/jdk) failed: 4294967295

您应该改用以下命令:

cp -R /Volumes/IntelliJ\ IDEA\ CE/IntelliJ\ IDEA\ CE.app/ /Applications/IntelliJ\ IDEA\ CE.app/

注意 -R 选项而不是 -r

根据 this man page-r 在 macOS 上的工作方式不同:

COMPATIBILITY

Historic versions of the cp utility had a -r option. This implementation supports that option; however, its use is strongly discouraged, as it does not correctly copy special files, symbolic links, or fifo's.