Does `Fish` change the order of $PATH? How to avoid that - macos

fish --version
> fish, version 3.0.2
uname -a
> Darwin Jerrys-MacBook.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
echo $TERM
> xterm-256color
I have compare my $PATH in bash and fish shell, the order of rvm changed, which cause which pod become different(i used rvm to manage ruby).
How can I make them same order ?
By the way,
I have include all my setting in .bashrc and load it by source ~/.bashrc in .bash_profile, noting in .prfile
And I have nothing in ~/.config/fish/config.fish
The begin character of x,~,=,> just I added mark to compare easily.
----- echo $PATH
=:~/.rvm/gems/ruby-2.2.9/bin
=:~/.rvm/gems/ruby-2.2.9#global/bin
=:~/.rvm/rubies/ruby-2.2.9/bin
X=:/opt/local/bin
X=:/opt/local/sbin
=:~/.nvm/versions/node/v8.11.3/bin
~:/usr/local/bin
~:/usr/bin
~:/bin
~:/usr/sbin
~:/sbin
>:/usr/local/share/dotnet
>:/opt/X11/bin
>:/Library/Frameworks/Mono.framework/Versions/Current/Commands
X-:~/.rvm/bin
X-:~/.local/bin
X-:/usr/local/Cellar/aria2/1.33.1/bin
X-:~/Documents/code/flutter/sdk/flutter/bin
X-:~/Documents/code/flutter/sdk/flutter/bin/cache/dart-sdk/bin
X-:~/Documents/code/flutter/sdk/flutter/.pub-cache/bin
------ fish & echo $PATH
~/usr/local/bin
~/usr/bin
~/bin
~/usr/sbin
~/sbin
>/opt/X11/bin
>/usr/local/share/dotnet
>/Library/Frameworks/Mono.framework/Versions/Current/Commands
=~/.rvm/gems/ruby-2.2.9/bin
=~/.rvm/gems/ruby-2.2.9#global/bin
=~/.rvm/rubies/ruby-2.2.9/bin
X=/opt/local/bin
X=/opt/local/sbin
=~/.nvm/versions/node/v8.11.3/bin
X-~/.rvm/bin
X-~/.local/bin
X-/usr/local/Cellar/aria2/1.33.1/bin
X-~/Documents/code/flutter/sdk/flutter/bin
X-~/Documents/code/flutter/sdk/flutter/bin/cache/dart-sdk/bin
X-~/Documents/code/flutter/sdk/flutter/.pub-cache/bin

Here is a simple workaround from this PR,
# Download patched config
curl -O https://raw.githubusercontent.com/fish-shell/fish-shell/e18354bc6ef937e2e663fc098cc51a2546d4d2d0/share/config.fish
# Install config
mv config.fish /usr/local/share/fish/

here how i solved it (using fish only as interactive on top of my zsh):
in .zshrc:
export ZSHPATH="$PATH"
fish
in .config/fish/config.fish
set PATH $ZSHPATH $PATH

To be simple, download & install the version fish-2.7.1.pkg which don't have this bug on Mac.
According to code commit, next version fish-3.1.0 may fix this bug.

Related

" command not found: evim " in terminal mac

I noticed this problem in my terminal some time ago, but I did not find a solution, is there any suggestion to solve this problem please
Thanks :)
My devise (MacBook Air M1)
system used macOS 13.0
vim --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Jul 12 2022 16:34:31)
macOS version - x86_64
Included patches: 1-50
Calling Vim with the -y flag is equivalent to calling evim:
$ vim -y
See :help evim.
If you prefer to type evim instead of vim -y, you can add an alias to your shell's configuration file:
$ echo 'alias evim="vim -y"' > ~/.zshrc
Now, your real problem seems to be that you have the string evim at the top of ~/.zshrc. Could you show us the file's content?
$ cat ~/.zshrc

Bash 5 readline vim mode prefixes not showing

.inputrc commands vi-cmd-mode-string and vi-ins-mode-string are not working. No prefix is shown at the beginning of the bash prompt. But the input mode is indeed vim (I can switch between command / insert mode).
I'm on macOS Catalina 10.15.1. I've installed bash with brew install bash (also tested brew install --HEAD to compile locally).
My bash version is 5.0.11. Should be enough for vi-ins|cmd-mode-string that is available since bash 4.4 (https://stackoverflow.com/a/32614367/2058840)
bash --version
GNU bash, version 5.0.11(1)-release (x86_64-apple-darwin19.0.0)
Copyright (C) 2019 Free Software Foundation, Inc.
I've also install readline via brew, but this changes nothing.
My .inputrc :
$if Bash
set editing-mode vi
$endif
$if mode=vi
set show-mode-in-prompt on
set vi-cmd-mode-string bbbbb
set vi-ins-mode-string aaaaa
$endif
What am I missing here? With this bash version, I expect bbbb or aaaa to be shown as the bash prompt prefix.
Ok. Just found out it's not a problem with the homebrew bash version.
My macOS user config still use the default bash version /bin/bash (bash 3) instead of the homebrew one /usr/local/bin/bash.
You can change yours with https://www.howtogeek.com/444596/how-to-change-the-default-shell-to-bash-in-macos-catalina/.
It took me time to understand that because of the bash --version test. This test the version of the first bash accessible in your $PATH. Not the bash used to open your shell.

How can i make ZSH use the latest git version?

I am using ZSH with oh-my-zsh on OS X.
Today I used hombrew to update to the latest version of git (1.8.something).
However, if I run
➜ ~ git --version
git version 1.7.10.2 (Apple Git-33)
I see that still an older version is used. On bash everything works fine and the latest version of git is called.
Since I am new to ZSH, any advice on how to set up ZSH to use the "new" git is appreciated!
Best,
Tobi
This means that your $PATH variable isn't set up to include the right git (and everything else homebrew installs).
Try doing echo $PATH from both bash and zsh. You should see at least one difference: the directory where you installed homebrew, probably /usr/local/bin. (It'll either not be in there, or be after /usr/bin, where the Apple-supplied binary lives.)
To fix it, add a line like
export PATH=/usr/local/bin:$PATH
to your ~/.zshenv.
If the PATH modification didn't instantly work, you need to realize that with zsh you need to type "rehash" for zsh to recognize there are new executables in the path. Or just log out and back in.
Compare the outputs of which git (and the outputs of echo "$PATH") in bash and zsh.
The directory containing an up-to-date git is probably not present in $PATH variable for zsh, but it is in bash. It's likely caused by $PATH items being added in your ~/.bashrc and/or ~/.bash_profile file, which zsh doesn't source on startup. If it's so, add the same assignment to PATH to your ~/.zshrc

After Installation RVM and Ruby 1.9.3 every Bash path change RVM Initialization Script is printed

I installed the latest RVM - Ruby Version Manager - and installed Ruby 1.8.7 and 1.9.3 on OSX Lion with XCode 4.3.3 using clang rvm install 1.9.3 --reconfigure --debug -C --enable-pthread --with-gcc=clang as the regular way did not work due to a GCC error. I did get one error clang: error: unsupported option '--with-libyaml, but Ruby 1.9.3 worked and I could run WPScan that needs at least 1.9.2 .
But now every time I run a command to change folder such as cd I get a long Bash script printed related to RVM - see http://pastebin.com/UAm38Vcm and:
.
How can I stop it from doing that?
Update I
Added a comment at RVM at Github as well https://github.com/wayneeseguin/rvm/issues/1039 , but as that issue is not 100% related and as I need this solved as soon as possible I opened a thread here with more data.
Update II
I realized the RVM Initialization script is the one that is being printed: https://github.com/wayneeseguin/rvm/blob/master/scripts/initialize . No idea why though..
Update IV
My .bashrc
# define aliases
alias sudo='sudo '
#alias ruby='ruby1.9'
alias apacherestart='sudo apachectl -k restart'
# define hist properties
HISTFILESIZE=1000000000
HISTSIZE=1000000
# define path to programs
PATH=/opt/local/bin:opt/local/sbin:/opt/subversion/bin:/opt/local/apache2/bin/:/opt/local/lib/python2.4/site-packages/django/bin:$PATH
# define manpath
MANPATH=/opt/local/share/man:$MANPATH
# export env vars
export HISTFILESIZE HISTSIZE PATH MANPATH
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
My .bash_profile
source ~/.bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Your cd command has somehow become aliased or a function has been created named "cd".
You can undo those with either:
unalias cd
or
unset -f cd
You should be able to revert temporarily with
unalias cd
It appears that you will need to figure out what was changed in your .bashrc and revert all those changes. If the installation script is at all sanely written, it should have made backups, or document somehow what was changed.

RVM is not working in ZSH

I'd like to try out the ZSH shell on my Mac, but I also do a lot of Ruby and Rails development, so I use RVM quite a bit too. The problem is that I can't seem to get RVM to work in ZSH, and it's working fine in the default Bash shell:
> zsh
> rvm 1.9.2
> ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
> which ruby
/usr/bin/ruby
I can definitely confirm that RVM is installed, as well as ruby 1.9.2 under RVM; I use it all the time in Bash. Running an rvm list in ZSH shows this, interestingly:
rvm rubies
ruby-1.8.7-p302 [ x86_64 ]
=> ruby-1.9.2-p0 [ x86_64 ]
This is happening on both my iMac and MacBook Pro. I am using OS X 10.6.6 on both, ZSH 4.3.9 on the iMac (4.3.10 on the laptop). Nothing fancy like oh-my-zsh just yet.
I tried looking at the documentation on RVM's website, but nothing helped me there.
Do you have this line in your ~/.zshrc?
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
Note March 2014:
With latest RVM, the following line:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
isn't needed anymore, and it shouldn't be in your ~/.zshrc.
Documentation has been updated in RVM documentation with Zsh:
Make sure in iTerm2 Preferences: Login shell option is set (do not use Command option). This is required for RVM to work.
If you are still getting rvm is not a function errors on iTerm, try:
rvm get stable --auto-dotfiles
Note November 2014
The rvm installation instructions warn that .zshrc doesn't include $PATH when setting PATH, thus replacing PATH's contents without regard for what already exists in PATH.
To remedy this I now append PATH to have .rvm/bin and then prepend $PATH at the beginning of setting PATH on the second line:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
export PATH=$PATH:"/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/mysql/bin:/opt/local/bin"
I had the same problem, I solved using this after "ruby on rails" installation:
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.zshrc
and
source ~/.zshrc
I use zsh, and had [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" in my .zshrc file, but was getting a parse error:404.
When I moved that line to the .profile file, the error stopped. It seems it was conflicting with something in my .zshrc file, and perhaps running it in .profile avoided the .zshrc file incompatibility. I haven't been able
I got it working on Manjaro Linux (zsh) by adding source /usr/share/rvm/scripts/rvm to $HOME/.zshrc

Resources