Pycharm terminal is missing part of $PATH


OSX terminal:

> echo $PATH


PyCharm terminal:

> echo $PATH



/usr/local/bin is missing in PyCharm terminal's $PATH.


My configuration:

The "Shell path" in PyCharm is set to: /bin/bash --rcfile ~/.pycharmrc

and the content of my .pycharmrc is just: source ~/.bash_profile

Putting an ECHO statement into my .bash_profile shows it gets executed when I start the terminal in PyCharm.




PyCharm Community Edition 2016.2
Build #PC-162.1237.1, built on July 20, 2016
JRE: 1.8.0_76-release-b216 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o


Encountering this issue on 2016.3

It seems the bash environment uses a PyCharm default path instead of the system's path. e.g. In addition to /usr/local/bin my Anaconda path is also missing.


Same issue here:

PyCharm 2016.3, Mac OS X 10.11.6

Path in the OS X Terminal App : /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/texbin

Path in the PyCharm terminal : /usr/bin:/bin:/usr/sbin:/sbin

No ~/.bash_profile, shell path in PyCharm: /bin/bash (default value)

(And everything worked well just before the update to 2016.3)


Potential Solution/Workaround:  (see StackOverflow)


Add your user's rc file to your Shell Path in:

    PyCharm Preferences --> Tools --> Terminal --> Shell path


I created a .pycharmrc file that sources the various files that I need for my projects (virtual environments, paths, etc).  This is what I added to my Shell path setting in PyCharm:

    /bin/bash --rcfile ~/.pycharmrc




thanks. do you know return default terminal as the userid-MacBook-Pro:mercury userid$?


@You6878 I feel like I'm unable to understand the question correctly.  I think you are asking about the user_id of the terminal.  If you are asking about the user_id for the terminal then it will be your current user_id since your user process launched it.  If you need to do some fancy setup or run a shell script to change conditions you can write that into your .pycharmrc file.  It gets executed with the --rcfile flag so anything inside will run.  This is why you can assign custom virtual environments to your shell.  Somewhere in your .pycharmrc (or whatever you call it) file you activate your virtual environment.  Likewise you can call source on your user's ~/.bashrc or ~/.bash_profile file and it will fix up your path and environment variables.

If I missed the question's goal then clarify how it was phrased and I'll see if I can offer any suggestions.


I think You6878 wants to know how to customize his command prompt in the terminal. To do this, add this line to your ~/.bashrc file (if you don't have a .bashrc file in your home directory, create one):

export PS1="\u-\h:\W \u$ "




Or maybe You6878ask why you don't get the exactly same integrated terminal in PyCharm than the one you get when using the "Terminal" app. (Because before PyCharm 2016.3 they was exacly the same, with the same path, etc). For example in the macOS terminal you have a  "<machine>:<path> <user>$" prompt but now you just have "bash-3.2$".

For me this all thing is a regression bug, as you loose features that you had in the previous version...


I'm experiencing the same problem as OP but it seems for different reasons.

Everything was working on 2016.2, stopped working on 2016.3. I use zsh.

Putting an echo in my .zprofile shows that it doesn't get executed. So /usr/local/bin isn't present in the path which leads to lots of problem.


Keeps failing.

2016.3.1 didn't fixed it at all.


Same problem here. Using Zsh.

Seems that when Zsh is run from PyCharm, it's not loading the startup files


But If launch PyCharm from the shell (using the charm command), it seems it inherits correctly all the environment variables and the terminal tool in PyCharm works flawlessly.

OS: OSX 10.11

PyCharm 2016.3.2
Build #PY-163.10154.50, built on December 28, 2016
JRE: 1.8.0_101-b13 x86_64
JVM: Java HotSpot(TM) 64-Bit Server VM by Oracle Corporation


The problem seems to happen only with "shell integration" enabled.

If I uncheck Tools > Terminal > "shell integration" terminal will load normally, with full $PATH and normal settings.


I'm having a similar issue. I use RubyMine normally, in which the terminal works just fine, but when trying to load the terminal in PyCharm, it errors (specifically, it complains about not being able to find `thefuck`, which is a tool referenced in my `.zshrc` file).

Using Federicojama's suggestion of unchecking shell integration didn't work, but Luis Benitez's suggestion of launching pycharm from the shell does work.


There is a known issue (PyCharm drops "/usr/local/bin" from PATH) in Pycharm bug tracker, please comment/vote for the issue to increase its priority and be notified about updates.


If you use ZSH as default shell, uncomment the first line of ~/.zshrc file to add the values to path variable. Is is default commented.

 # If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH


The above solution worked for me. Thanks 096103006!


Please sign in to leave a comment.