Start /usr/bin/login instead of /bin/bash in PyCharm terminal - bash

After updating to PyCharm 2016.3 my terminal has changed.
In 2016.2 it fired up identical to iTerm or Terminal. Now I am supposed to run /usr/bin/login to achieve it, because PyCharm only invokes /bin/bash and if I change shell path to /usr/bin/login in preferences terminal will collapse right after starting. I assume this is happening because /usr/bin/login requires login and password.
I am a little bit confused and after some research can't figure out what is going under the hood and what should I do to startup shell as in iTerm. May somebody clarify this, please?
UPD: Fixed in 2016.3.2 (in my case)

This worked for me in macOS:
1) Open in PyCharm
Preferences > Tools > Terminal > Shell path
2) Replace
/bin/bash
with
/bin/sh -login -i
Source: https://www.jetbrains.com/help/pycharm/2016.3/working-with-embedded-local-terminal.html

I got this problem too, and it is quite annoying.
The best solution I found so far is to run bash -l in the Terminal of PyCharm every time I start using it.
I tried to put /bin/bash -l into PyCharm Preferences > Tools > Terminal > Shell path, but that doesn't work.

I got the same issue and this issue is common when one installs PyCharm CE from the application market like Software Center in Ubuntu. To get /bin/bash by default in PyCharm CE terminal, you should install it by using Jetbrains Toolbox for any version of PyCharm CE and Linux distro.

Related

Why is git bash behaving weird on PyCharm?

I am using PyCharm 2019.3.3 (Community Edition) on Windows 8. I wanted to integrate Git bash in the PyCharm terminal. I have set the shell path in the terminal application settings of PyCharm as
C:\Program Files\Git\bin\bash.exe
The problem occurs when I activate a venv virtual ennvironment, set up using
python -m venv env
by running
source env/Scripts/activate
I think env is active as I see two parenthesis, () and typing pip freeze displays all installed packages in env. But this is accompanied with an error message that displays in the terminal
bash: basename: command not found
This same message is logged after typing commands like ls, clear which doesn't work but pip freeze and pip --version work. And when I deactivate env, ls, clear and pip stopped working displaying the mentioned error message.
All this problems do not occur in the Git bash application for Windows irrespective of whether I am in env or global environment and all commands work properly. I know I can just use Git bash instead of the integrated terminal of PyCharm but just wanted an answer to this problem.
What seems to be the problem here? Am I setting up my shell path wrongly or is this problem specific to PyCharm?
I solved this issue by disabling "Activate Virtualenv" checkbox in File -> Settings -> Tools -> Terminal
Since, pycharm documents does not show any support for 'Git Bash', that is probably the reason for this weird behaviour.
Terminal Options in Pycharm

iTerm and terminal fail immediately on Mac - 'BrokenPipe'

This happened right after I tried to install pyenv and then virtualenvrapper.
As soon as I open iTerminal I get a "Broken Pipe" message and macOS terminal also shuts down immediately.
I have been trying to debug my .bash_profile but uncommenting one after another but without avail
I tried updating homebrew and bash but no change (using a previously open iterm session)
I restarted my computer with the unfortunate effect that I can't access iterm or terminal now (all old sessions closed)
I am quite at loss here now, I have no clue why this happened and how to go about fixing it without having a functioning terminal.
I'd appreciate any advice or pointers.
Following #user1934428 advice I added set -x to all the bash startup files, unfortunately was still met with the same problem. Changing the startup shell in the terminal preferences didn't work.
Thankfully when using emacs ansi-term I was able to get some information/feedback message:
The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit https://support.apple.com/kb/HT208050.
Following the link I found that default shell has been changed to zsh Catalina. So I went and followed the instructions on the support page and changed the default shell back to bash, which fixed the problem. I am not quite sure why this problem occurred initially since the Broken Pipe Error appeared before I updated to Catalina.
Anyways changing the default shell back to bash shell fixed everything

How to activate a conda env automatically in VSC on windows using bash?

I've been trying all day to debug a code using Visual Studio Code without success. I have installed VSC on windows and I have installed bash (ubuntu) as well. I already put bash as a terminal default shell:
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\bash.exe"
The thing is when I run the debug, it tries to activate the env with activate myenv-name and I couldn't find how to change this instruction to source activate myenv-name.
Do you know how I can do this? any help will be appreciated. Thanks!
It's been a while since I asked this question and I got the answer finally. :)
It is simple we just have to create .bashrc file in our user folder there we can write whatever commands we need to run each time we start a terminal in vscode.
Here the command to activate a conda env:
source activate myenv_name
In case of bash: conda: command not found and you don't have admin permissions to change the paths use this command before source act...:
export PATH=$"/c/Users/UserName/AnacondaPath/Scripts":$PATH

ZSH Setup on Mac OS

Hi guys I have various problems with my ZSH shell. I installed Hyper Terminal for Mac and Oh My ZSH with a specific theme.
It works, however I have two problems:
1.) I have no internet connection, due to our corporate proxy. I tried almost everything. export http_proxy=http://my.proxy.dns:8080/ doesn't work and so on.
2.) I don't have the same environment variables as in my standard bash shell. For example when I run 'git' or 'npm' I always get zsh: command not found npm for example.
Now it seems I just need to apply my bash-config to my zsh shell.
I have for example tried setting: export PATH=$HOME/bin:/usr/local/bin:$PATH inside my .zshrc but no luck. Also source with my bashprofile doesnt seem to work.
How can I do that?

Run a C++ program in Clion as root

I'm trying to run a program written in C++ by using CLion v1.2 as super user. Anyone here knows how to run it as superuser? I'm using CMake.
I solved this by remote debugging on local machine. I run gdbserver with root privileges and connected to it from CLion.
To start gdbserver sudo gdbserver :port myapp, configure remote GDB debug with port
This was already implemented on CLion, starting 2020.3:
https://www.jetbrains.com/help/clion/debug-as-root.html
If you are asking to run the debugger as sudo/administrator, I had the same issue. On Linux you can open CLion as sudo and gdb will not have root permission issues running an executable:
sudo ./clion.sh
I would guess that you could right click in Windows and "Run as administrator" to get the same result.
There is a feature request into JetBrains to run the debugger as root that could use more up voting.
A workaround is:
From https://www.jetbrains.com/help/clion/attaching-to-local-process.html#prereq-ubuntu
If you are using CLion on Ubuntu (or probably, on some other Linux distribution), upon the first attempt to attach to the local process you can get the ptrace: Operation not permitted. error message. To disable it and enable attach to the local process feature, do the following:
To disable this restriction temporarily, enter the command:
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
To disable this restriction permanently, open the file /etc/sysctl.d/10-ptrace.conf for editing and change the line kernel.yama.ptrace_scope = 1 to kernel.yama.ptrace_scope = 0. To apply the changes, enter:
sudo service procps restart or restart your system, at your choice.
You can create a bash script to help you. For example, run.sh:
#!/usr/bin/env bash
echo $LOGIN_PASSWD | sudo -S yourExecutable --with=some-arguments
Don't forget to chmod a+x run.sh, and export the password of current account as an environment variable in Run/Debug Configurations.

Resources