How to launch PyCharm from terminal/command prompt
Asked Answered
F

9

9

How can I launch PyCharm from terminal / command prompt? I tried charm, charm., pycharm., pycharm.

None of these commands work.

Is it possible to open/launch PyCharm from a command prompt / terminal ?

Falgoust answered 29/11, 2018 at 9:41 Comment(0)
G
6

From examining the shortcut on my Ubuntu desktop (on which I have the community version of Pycharm installed) the command it runs is "pycharm-community" So this works when run in a terminal, for example:

pycharm-community &

If you are using Windows, you can use the same trick to find out where Pycharm is installed (examining the shortcut on your start menu or desktop). For me, it is:

"C:\Program Files (x86)\JetBrains\PyCharm 2016.3.1\bin\pycharm64.exe"

Running that from a git bash prompt launches Pycharm for me.

You probably want to examine your own shortcut to find the correct location on your computer.

You can find the shortcut file from the Start Menu by right-clicking on the Pycharm entry and selecting Open file location. Or you can just look at the shortcut on your desktop if you have one there.

When you have located the shortcut file, right-click it, click Properties, select the Shortcut tab, and look in the field called Target: to see the location of the Pycharm executable.

Galosh answered 29/11, 2018 at 9:49 Comment(4)
i try to use this cmd via Git Bash. It's doesn't work.Falgoust
@lyca I think that means you are using Windows? Right?Galosh
yeap. My os is windows.Falgoust
@lyca Great, thanks, I've added a section covering Windows / git bash to my answer.Galosh
F
6

This works on macOS (should work with other OSes too):

  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

Answer credit

Foredeck answered 16/3, 2021 at 23:52 Comment(0)
L
5

If you are using ubuntu, go to pycharm/bin folder and run pycharm.sh file using below command

./pycharm.sh

Languishment answered 29/11, 2018 at 9:44 Comment(0)
D
2

Add path of PyCharm to your environment variables.

As user @Rob Brincheno metioned

When you have located the shortcut file, right-click it, click Properties, select the Shortcut tab, and look in the field called Target: to see the location of the Pycharm executable.

For the example, let's say the path is:

"C:\Program Files (x86)\JetBrains\PyCharm 2016.3.1\bin\pycharm64.exe"

Copy all to last part, don't copy pycharm64.exe

Read this for how to add PyCharm to your environment variables.

After you add it to path, from your cmd you can execute it as last part you didn't add, just type:

pycharm64

and it will start.

Djerba answered 30/11, 2018 at 19:15 Comment(2)
If you are setting environment variables through an admin account, be sure to set them for the system. If not, your cmd/bash will not find the new path on your regular user account. I dealt with this for the past couple of hours and just realized my reg account name was the same as my admin account name, but the PATH variables are very different across the two.Hornmad
the path will change everytime you update the program, and then break againSuneya
N
2

Redirect to your codebase directory and type pycharm-community . in the terminal

Works with Ubuntu, macOS, and Windows

Ninnyhammer answered 4/9, 2019 at 8:20 Comment(0)
S
0

This worked for me on my 2017 imac macOS Mojave (Version 10.14.3).

  1. Open your ~/.bash_profile: nano ~/.bash_profile

  2. Append the alias: alias pycharm="open /Applications/PyCharm\ CE.app"

  3. Update terminal: source ~/.bash_profile

  4. Assert that it works: pycharm

Strangulation answered 17/3, 2019 at 18:53 Comment(0)
P
0

Something similar to what @timxor suggested, but without all of the output and leaving the terminal free to keep using...

Paste this in your .bsahrc file

pycharm () {
    # opens pycharm with the correct param and detachs it from terminal
    # change <pycharm.sh> with the location for pycharm.sh
    # ~/.local/share/JetBrains/Toolbox/apps/PyCharm-C/ch-0/223.8214.51/bin/pycharm.sh in my case
    nohup sh <pycharm.sh> $1 > /dev/null 2>&1&
}
Pepperandsalt answered 25/1, 2023 at 20:20 Comment(0)
D
0

(Mac solution) If you just want to open pycharm from the terminal, you can put this command: open -na "PyCharm.app" in yours .bashrc as a alias.

Decanter answered 15/2, 2023 at 18:1 Comment(0)
S
0

Windows Users, please upvote this issue so we can use something like:

~\AppData\Local\JetBrains\Toolbox\bin\jetbrains-toolbox.exe -launch pycharm and it'll automatically launch the installed version regardless of location

Suneya answered 29/3, 2023 at 7:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.