IntelliJ: how to open files in an existing IntelliJ from the command line

MacosCommand LineIntellij Idea

Macos Problem Overview


I always have an IntelliJ running. Sometimes I want to open a file from outside IntelliJ. I can drag and drop a file to IntelliJ if am in the Finder, but if I am on the command line on OS X, how can I instruct IntelliJ to open a certain file? I am looking for something similar to the mate command provided by TextMate.

Macos Solutions


Solution 1 - Macos

It's actually already implemented in the linux and OS X version of IntelliJ IDEA.

Tools > Create Command-line Launcher...

Not sure it's available for windows.

Solution 2 - Macos

Edit your ~/.bash_profile adding the following, changing the path to version of IntelliJ you'd like to use:

alias "ij=open -a /Applications/IntelliJ\ IDEA\ 9.0.2.app"

Then from the command line, open files with ij your-file.txt.

Solution 3 - Macos

idea is the command you are looking for.

At least if you install "IntelliJ IDEA Ultimate", it will create the command idea by default in /usr/local/bin/

Solution 4 - Macos

If you want to open file from internel terminal in idea, using following command and press CTRL+ENTER:

open path/of/your/file

absolute path and relative path are all supported.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionavernetView Question on Stackoverflow
Solution 1 - MacosTimothée JeanninView Answer on Stackoverflow
Solution 2 - MacosavernetView Answer on Stackoverflow
Solution 3 - MacosKlas MellbournView Answer on Stackoverflow
Solution 4 - MacossoolaugustView Answer on Stackoverflow