macos Mac OS X 上的命令行 IntelliJ

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7836492/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:31:34  来源:igfitidea点击:

command line IntelliJ on Mac OS X

macosintellij-idea

提问by MK.

I'm trying to launch IntelliJ on command line in Mac OS X to use it's diff tool. Theoretically idea.sh diff file1 file2should work. In practice there are some issues with the file which I think I worked around (removing some arguments to readlink etc).
However when it does start, it wants me to enter license information (even though an instance of Intellij is already running and the license is there). Which leads me to believe that there is some sort of separation of command line world vs non-command line world on Mac OS X? IS that true?
Also when I select 30 days eval it proceeds to give me the following exception:

我正在尝试在 Mac OS X 的命令行上启动 IntelliJ 以使用它的差异工具。理论上idea.sh diff file1 file2应该有效。在实践中,我认为我解决的文件存在一些问题(删除了 readlink 等的一些参数)。
但是,当它启动时,它希望我输入许可证信息(即使 Intellij 的实例已经在运行并且许可证在那里)。这让我相信 Mac OS X 上的命令行世界与非命令行世界存在某种分离?真的吗?
此外,当我选择 30 days eval 它继续给我以下异常:

java.lang.IllegalArgumentException: Argument 0 for @NotNull parameter of com/intellij/openapi/fileEditor/impl/FileEditorProviderManagerImpl.getProviders must not be null
    at com.intellij.openapi.fileEditor.impl.FileEditorProviderManagerImpl.getProviders(FileEditorProviderManagerImpl.java)
    at com.intellij.openapi.diff.impl.highlighting.EditorPlaceHolder.setContent(EditorPlaceHolder.java:73)
    at com.intellij.openapi.diff.impl.highlighting.DiffPanelState.run(DiffPanelState.java:38)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:864)
...

采纳答案by CrazyCoder

Try running /Applications/IntelliJ\ IDEA.app/Contents/MacOS/ideainstead. idea.shis not designed for Mac and will not work without some manual changes.

尝试跑步/Applications/IntelliJ\ IDEA.app/Contents/MacOS/ideaidea.sh不是为 Mac 设计的,如果没有一些手动更改将无法运行。

Another option is to create the command line launcher: Tools | Create Command-line Launcher.

另一种选择是创建命令行启动器:工具 | 创建命令行启动器。

If you are using Toolbox, it provides the way to create the command launcher automatically.

如果您使用的是Toolbox,它提供了自动创建命令启动器的方法。

回答by Meeh

IntelliJ can install a command line launcher for you, adding it to a PATH directory would make it as any other commands on the system. The command is "idea".

IntelliJ 可以为您安装命令行启动器,将其添加到 PATH 目录将使其与系统上的任何其他命令一样。命令是“想法”。

IntelliJ Command-line Launcher

IntelliJ 命令行启动器

回答by R K Punjal

Try:

尝试:

Tools > Create Commandline Launcher

工具 > 创建命令行启动器

This will create a command line launcher. After that you can launch IntelliJ from your desired folder like with a command like this :

这将创建一个命令行启动器。之后,您可以使用如下命令从所需的文件夹启动 IntelliJ:

idea .

or

或者

idea <path to the folder>

回答by Halil ?brahim Küley

First step, you'll follow and click the menu, Tools > Create Commandline Launcheryou'll run this command on what you want open project's directory.

第一步,您将按照并单击菜单工具 > 创建命令行启动器,您将在您想要打开项目的目录上运行此命令。

idea .

回答by Andrew E

Idea expects paths to be fully qualified, so I wrote a small helper script. Invoke like:

Idea 期望路径是完全限定的,所以我写了一个小的帮助脚本。像这样调用:

$ idiff foo.txt bar.txt

The code for idiff:

代码idiff

#!/bin/bash
idea='/Applications/IntelliJ IDEA 10.app/Contents/MacOS/idea'
left=`abspath `
right=`abspath `
"$idea" diff $left $right

There is probably a real abspathtool somewhere, but I have a simple hand-rolled one:

abspath某处可能有一个真正的工具,但我有一个简单的手工工具:

$ cat `which abspath`
#!/bin/bash
ORIG_DIR=`pwd`
for fn in $* ; do 
  if [ -e $fn ]; then
    d=`dirname $fn`
    if [ -z $d ]; then 
      echo `pwd`/$fn
    else
      cd $d
      echo `pwd`"/"`basename $fn`
    fi
  else
    echo "Don't know how to process $fn" 1>&2
    exit 1
  fi
  cd $ORIG_DIR
done

回答by arcseldon

If you have the toolbox installed, this is now controlled using the Toolbox App Settings.

如果您安装了工具箱,现在可以使用工具箱应用程序设置进行控制。

First enable using the (global) toolbox app settings:

首先使用(全局)工具箱应用程序设置启用:

enter image description here

在此处输入图片说明

Now, you can enable at the IDE level (here using Intellij):

现在,您可以在 IDE 级别启用(此处使用 Intellij):

enter image description here

在此处输入图片说明