Goal: get Poetry working.
Using Git Bash on Windows 10 with WSL 2.
I have Anaconda3 and Git working.
pip install bash worked but did not help.
Git Bash:
(base)
HDS+dabell#PF2DCSXD MINGW64 ~
$ sudo -s
bash: sudo: command not found
(base)
HDS+dabell#PF2DCSXD MINGW64 ~
$ su -
bash: su: command not found
(base)
HDS+dabell#PF2DCSXD MINGW64 ~
$ apt update
bash: apt: command not found
(base)
HDS+dabell#PF2DCSXD MINGW64 ~
$ apt install sudo -y
bash: apt: command not found
(base)
HDS+dabell#PF2DCSXD MINGW64 ~
$ cat ~/.bashrc
. /c/Users/dabell/Anaconda3/etc/profile.d/conda.sh
(base)
These commands work in WSL 2.
As stated by #tkausl, Git Bash does not come with such commands.
I've also found a similar post on Stack Overflow, the top answer stating the same.
Related
I just installed Angular and after the default installation (as set out here: https://angular.io/guide/setup-local). After running the standard commands my terminal would not recognise ng (so I could not use ng new my-app).
To solve this problem I did the following based on a stackoverflow answer:
echo -e "export PATH=$(npm prefix -g)/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
ng --version
(I had no knowledge of what PATH was when doing this, or what the command I was running did...)
This worked, and my ng --version returned a result and I was able to build and run an Angular app.
However when I opened a new tab in my terminal all my normal terminal 'styles' (I use zsh) had gone.
My friend and I tried to resolve the problem, which he felt might be related to my terminal settings (his 'Command (complete path)' read: /usr/local/bin/zsh, and mine was /bin/zsh). So we tried a few things but none have worked and it might be worse - this included resetting my $PATH based on another stackoverflow answer to /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Apple/bin.
We also switched back and forth from /bin/zsh to /bin/bash to try and resolve things, but this did not do anything.
The current state of things is that I cannot run rails commands where I normally could (for example), also things like ll (which returns zsh: command not found: ll).
This is my .zsh_history file:
which zsh
which bash
cd code
cd
ls
lsa
ls -a
cat .aliases
vi .aliases
sudo v
sudo vi .aliases
npm install -g angular
npm list
npm install -g #angular/cli
cd code
ls
cd JoshInLisbon
cd ..
JoshInLisbon
ls
mkdir Angular
mkdir Rails
cd rails
ls
cd ..
open
open .
cd WALD
ls
ll
lll
ls -a
cat .git
.git
ls
ls -a
cd ..
..
JoshInLisbon
..
JoshInLisbon
ls
cd Angular\ Projects
ng new my-first-app
which ng
which angula
which angular
echo $path
npm -v
which node
node -v
npm install -g #angular/cli
ng --version
brew install node
node -v
brew postinstall node
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
npm install -g n
sudo npm install -g n
sudo n stable
brew doctor
npm -v
which brew
which npm
brew -v
brew update
npm -v
npm install npm
npm -v
npm install -g npm
npm install -g #angular/cli
ng --version
npm ls --global --depth 0
npm install -g #angular/cli#latest
echo -e "export PATH=$(npm prefix -g)/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
ng --version
cat ~/.bashrc
echo $PATH
ng new my-app
ls
my-app
npm outdated
..
npm install --save core-js#^3
my-app
npm install --save core-js#^3
npm install --save-dev "jasmine-core#>=3.5"
ng serve --open
exit
ls
cd code
ls
codesign
code
ls
cd code
ls
cd JoshInLisbon
ls
cd an
cd Angular\ Projects
ls
cd my-app
code
ng
code
code --
ls
cd ..
cd taaalk
cd ..
cd taaalk_edge
echo $PROMPT
zsh --version
chsh -s
ls
cd code
ls
cd JoshInLisbon
chsh -s /bin/bash
ls
zsh --version
ls -a
cat .zshrc
cd .zshrc
echo $PATH
echo $PATH
vim
cat
ls -a
vim .zshrc
vim .bash_profile
~/.MacOSX/environment.plist
echo $PATH
plutil -lint ~/.MacOSX/environment.plist
xcode-select --install
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
ls
ls -a
cat .zshrc.backup
cd code
cd JoshInLisbon
cd Rails\ Projects
rails new thing
rails new thing
echo $PATH
..
ls ..
cd ..
cd ..
cd
ls -a
cat .zshrc.backup
ls -a
cat .zsh_history
vim .bash_profile
ls -a
vim .zcompdump-jmpb-5.7.1
vim zshrc.backup
cat .zshrc
.zsh_history
vim .zshrc
vim .shell.pre-oh-my-zsh
ll
ll -a
I can see my .zshrc file when I do ls -a, however it is empty.
This is my .bash_history
ls
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
history
which zch
which zsh
echo path
echo $PATH
cd code
cd JoshInLisbon/
rails new project
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
echo $PAtH
echo $PATH
rails new
npm -version
which zsh
cd ..
cd ~
ls
ls -a
cat .szhrc
cat .zshrc
cat .zshrc
ls -a
cat .bash_profile
echo $PATH
cat .zsh_history
cat .bashrc
export PATH=/Users/joshua/.npm-global/bin:./bin:./node_modules/.bin:/Users/joshua/.rbenv/shims:/Users/joshua/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Apple/bin:/usr/local/sbin
echo $PATH
which ruby
which zsh
cd code/
cd JoshInLisbon/
cd Rails\ Projects/
rails new thing
ls
rm -R thing
ls
which brew
which zsh
cd ..
cd
ls
ls -a
cat .zshrc
cat .zshrc
cat .bash_profile
cat .oh-my-zsh/
cd .oh-my-zsh/
ls
cat .oh-my-zsh.sh
cd
ls
ls -a
cat .zshrc.backup
echo $ZSH
export ZSH="/Users/joshua/.oh-my-zsh"
echo $ZSH
which rails
ll
This might be my old path? export PATH=/Users/joshua/.npm-global/bin:./bin:./node_modules/.bin:/Users/joshua/.rbenv/shims:/Users/joshua/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Apple/bin:/usr/local/sbin
Anyway, you are a hero if you made it this far and if you have any idea what I should do I would be very grateful.
This was resolved by moving my dotfiles (which contains all my zsh settings) back to the original location. The change was caused by the re-ordering of many folders.
I also restored my PATH back to the old one pasted at the bottom of the question.
Once you've installed anaconda/conda, and configured your shell init file to set the path, how can you temporarily escape from that environment to use the system tools, for example the version of python that was installed natively?
If you did a default install and, therefore, followed the best practice configuration introduced in Conda v.4.4, then it is simply a matter of deactivating the base env:
conda deactivate
merv's answer is better...
Here is a way to do this on the fly without editing one's init files:
(base) ➜ ~ which python
/home/xxx/anaconda3/bin/python
(base) ➜ ~ echo $PATH
/home/xxx/anaconda3/bin:/home/xxx/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
(base) ➜ ~ export PATH=$(echo ${PATH} | awk -v RS=: -v ORS=: '/conda/ {next} {print}' | sed 's/:*$//')
(base) ➜ ~ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
(base) ➜ ~ which python
/usr/bin/python
(base) ➜ ~
I am facing some issues while installing go lang, have used below approach to install it.
sudo apt update
$ sudo curl -O https://storage.googleapis.com/golang/go1.10.1.linux-amd64.tar.gz
$ sudo tar -xvf go1.10.1.linux-amd64.tar.gz
$ sudo mv go /usr/local
everything went fine till the above step.
But when I am giving below command, I am getting a message
$ echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.profile
Message: bash: export: '/usr/local/go/bin': not a valid identifier
$ source ~/.profile
Try this script:
git clone https://github.com/udhos/update-golang
cd update-golang
sudo ./update-golang.sh
Full details: https://github.com/udhos/update-golang
I am trying to update my /etc/shells file to include the path to a homebrew installed version of bash which resides at /usr/local/bin/bash
$ sudo echo /usr/local/bin/bash >> /etc/shells returns Permission denied and attempting to manually update is not allowed as it appears to be read-only.
Upon inspecting the file, the permissions are set as follows:
-rw-r--r-- 1 root wheel 179 Feb 21 2017 /etc/shells
So, with this in mind, and after looking at this article about Updating you shell with Homebrew I tried to initiate a shell as the root user and then try command above, i.e:
$ sudo -s
$ echo /usr/local/bin/bash >> /etc/shells
$ chsh -s /usr/local/bin/bash
However, this seems to hang on the first command ($ sudo -s). This spawns a bash process that eats up ~ 70% CPU and nothing happens.
Is there an alternative way one can update the /etc/shells/ file?
An approach to adding to a root-only file is echo /usr/local/bin/bash | sudo tee -a /etc/shells.
– Petesh
Would you be able to explain why that works and the sudo echo /usr/local/bin/bash >> /etc/shells does not though.
The latter doesn't work because the output redirection >> is (tried to be) applied by the shell before the sudo … is executed, and of course the user shell has no permission to do that.
Or you can just use this (I had to do this on macOS Mojave):
sudo sh -c "echo $(which zsh) >> /etc/shells"
chsh -s $(which zsh)
I followed the instructions from the RVM homepage (https://rvm.beginrescueend.com/rvm/install/)
I typed the following:
sudo bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
the script executed and didn't seem to give any errors.
the same without sudo gave an error:
Warning: Failed to create the file
Warning: /usr/share/ruby-rvm/archives/wayneeseguin-rvm-stable.tgz: Permission
Warning: denied
0 792k 0 3908 0 0 2257 0 0:05:59 0:00:01 0:05:58 2257
curl: (23) Failed writing body (0 != 3908)
Could not download 'https://github.com/wayneeseguin/rvm/tarball/stable'.
curl returned status '23'.
I also put this in my ~/.bashrc
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
what I get is:
~$ type rvm | head -1
bash: type: rvm: not found
~$ source "/usr/local/rvm/scripts/rvm"
bash: /usr/local/rvm/scripts/rvm: No such file or directory
~$ source "$HOME/.rvm/scripts/rvm"
bash: /home/anonym/.rvm/scripts/rvm: No such file or directory
How can this be fixed?
PS
I'm using Ubuntu 11.10
Sudo problems. This worked for me to install rvm. Just do:
curl -L https://get.rvm.io | sudo bash -s stable --ruby
nano ~/.bashrc
at the bottom of the file add these line
unset rvm_path
unset GEM_HOME
Then run
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 2.1.3
rvm use 2.1.3 --default
ruby -v
Can you try this:
$ curl -s raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable
or
$ curl -s raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | sudo bash -s stable
depending on your permissions. That should help. It helped me! :)
I'm sure there's a more elegant way to fix this, but I ran into the same issue and was kinda in a hurry, so I went for a quick and dirty workaround:
$ curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer > foo.sh
$ chmod 755 foo.sh
Then edit line 162, and add -k to the curl command:
$ vim foo.sh
162 if curl -Lk https://github.com/${_repo}/rvm/tarball/${_branch} -o ${rvm_archives_path}/${_repo}-rvm-${_branch}.tgz
Then run the script:
$ ./foo.sh --branch stable
Like I said, not ideal, but it got me where I needed to be quickly.
If anyone has this problem in the future in ubuntu I was getting this error because of an old package that still had config stuff hanging around.
Try running
sudo apt-get --purge remove ruby-rvm
That should take care of the permission error and let you install RVM as a normal user under $HOME/.rvm
Put this in your .bashrc instead (without echo)
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
And restart your terminal.
You might have RVM installed under the wrong user. RVM won't let you install if it's installed under another user.
You can uninstall it from the other user with rvm implode.
Log over to the other user and RVM will install correctly!
https://rvm.io/rvm/security#ipv6-issues
You can forbid gpg's internal dirmngr from using IPv6 by add the following line to ~/.gnupg/dirmngr.conf: