Reputation: 34527
I'm trying to launch IntelliJ on command line in Mac OS X to use it's diff tool. Theoretically idea.sh diff file1 file2
should 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:
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$1.run(DiffPanelState.java:38)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:864)
...
Upvotes: 58
Views: 83597
Reputation: 51
Tested for the new versions of IntelliJ in 2023: -
add this line in .zhsrc:
alias idea="/Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea"
Upvotes: 5
Reputation: 1068
In the case of PHPStorm, you need to do the same - Tools > Create Commandline Launcher
but inside Terminal you should use pstorm .
Upvotes: 0
Reputation: 9118
First you must create the shell scripts to open the IDEs, in the latest version it's done on the Toolbox
Toolbox App > Configuration > Settings > Generate shell script > export to a folder like /User/asilva/IDEs
Then you could call it like ./User/asilva/IDEs/idea
or ./User/asilva/IDEs/webstorm
But if you want to call it without the absolute path, the it's needed to add it on the $PATH to be loaded every time the terminal is open:
~/.zshrc
(...)
# idea + webstorm
export PATH="/Users/asilva/IDEs:$PATH"
with this, the webstorm
or idea
command will be globally available
Upvotes: 0
Reputation: 401965
Try running /Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea
instead. idea.sh
is not designed for Mac and will not work without some manual changes.
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.
Upvotes: 38
Reputation: 37105
If you have the toolbox installed, this is now controlled using the Toolbox App Settings.
Upvotes: 10
Reputation:
First step, you'll follow and click the menu, Tools > Create Commandline Launcher you'll run this command on what you want open project's directory.
idea .
Upvotes: 14
Reputation: 1475
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 :
idea .
or
idea <path to the folder>
Upvotes: 36
Reputation: 2646
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".
Upvotes: 198
Reputation: 8327
Idea expects paths to be fully qualified, so I wrote a small helper script. Invoke like:
$ idiff foo.txt bar.txt
The code for idiff
:
#!/bin/bash
idea='/Applications/IntelliJ IDEA 10.app/Contents/MacOS/idea'
left=`abspath $1`
right=`abspath $2`
"$idea" diff $left $right
There is probably a real abspath
tool somewhere, but I have a simple hand-rolled one:
$ 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
Upvotes: 6