Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch Pycharm from command line (terminal)

I want to try out PyCharm for sage mathematics development. Normally I run eclipse to do sage development, but now I want to try it with PyCharm.

To launch eclipse with sage environment variables, in command line I normally do the following:

sage -sh
cd /path/to/eclipse
./eclipse

The first line loads the sage environment variables, the remainder launches eclipse. How can I do the same thing for pyCharm? (note I am using a Mac and Ubuntu for sage development; the commands above are agnostic to both OSes)

  1. Link 1 is close to the solution I am looking for, however I cannot find a pyCharm.sh anywhere.
  2. Link 2: Jetbrains does not give clear instructions either.
like image 614
torrho Avatar asked Mar 02 '14 21:03

torrho


People also ask

How do I open PyCharm in Linux terminal?

Start Pycharm using the pycharm.sh cmd from anywhere on the terminal or start the pycharm.sh located under bin folder of the pycharm artifact. 2. Once the Pycharm application loads, navigate to tools menu and select “Create Desktop Entry..” 3. Check the box if you want the launcher for all users.

How do I start PyCharm from command line?

From the main menu, select View | Tool Windows | Terminal or press Alt+F12 .

How do I open a PyCharm project in terminal?

To run PyCharm from the shell, use the open command with the following options: -a : specify the application. --args : specify additional arguments when passing more than just the file or directory to open. -n : open a new instance of the application even if one is already running.


3 Answers

Edit (April 2020): It seems that launcher script creation is now managed in Toolbox App settings. See the Toolbox App announcement for more details.

--

  1. Open Application Pycharm
  2. Find tools in menu bar
  3. Click Create Command-line Launcher
  4. Checking the launcher executable file which has been created in /usr/local/bin/charm
  5. Open project or file just type $ charm YOUR_FOLDER_OR_FILE

Maybe this is what you need.

like image 134
joest Avatar answered Oct 22 '22 05:10

joest


Inside the IDE, you can click in:

Tools/Create Command-line Launcher...

Create Command-line Launcher

like image 20
augustocbx Avatar answered Oct 22 '22 05:10

augustocbx


You're right that the JetBrains help page isn't very clear. On OS X, you'll want to use the launcher at:

/Applications/PyCharm.app/Contents/MacOS/pycharm

Or, for community edition:

/Applications/PyCharm\ CE.app/Contents/MacOS/pycharm

Unfortunately, adding a symlink to this binary wouldn't work for me (the launcher would crash). Setting an alias worked, though. Add this in your .bash_profile (or whatever shell you use):

alias pycharm="/Applications/PyCharm CE.app/Contents/MacOS/pycharm"

Then, you can run commands with simply pycharm.

With this you can do things like open a project:

pycharm ~/repos/my-project

Or open a specific line of a file in a project:

pycharm ~/repos/my-project --line 42 ~/repos/my-project/script.py

Or view the diff of two files (they don't need to be part of a project):

pycharm ~/some_file.txt ~/Downloads/some_other_file.txt

Note that I needed to pass absolute paths to those files or PyCharm couldn't find them..

like image 34
ford Avatar answered Oct 22 '22 05:10

ford