Comments (19)
It also stopped working for me. I haven't used it in a while but somehow now I'm always stuck with the system ruby on OSX and chruby
seems to do nothing.
from chruby-fish.
Interesting π€
I can't see any reason why this shouldn't work. The only curious thing is that your echo $PATH
shows a completely default list of PATH values, nothing being injected by chruby-fish, but also nothing injected by VMWare Fusion, or any other utility.
What is the output of echo $PATH
before you invoke chruby-fish
?
My initial guess would be that there's something wrong with your $PATH
regardless of what chruby-fish is doing, but that's just a guess right now.
from chruby-fish.
Hi @JeanMertz - I cropped the path so it wouldn't be so long .... /Applications/VMware Fusion.app/Contents/Public
is at the end of both (bash and fish) echo $PATH
commands. Sorry if that threw you off, was just trying to be concise.
For now, I am manually exporting the path before before I execute the rails
commands:
set PATH -gx /Users/damon/.gem/ruby/2.5.0/bin /Users/damon/.rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/bin /Users/damon/.rubies/ruby-2.5.0/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin; and bundle exec rails server
This works ... but am not sure why chruby 2.5.0
isn't able to do the same thing in fish.
from chruby-fish.
I checked, but chrubby hasn't been updated, chruby-fish also hasn't needed an update in a long time, so something else must have changed. Did you perhaps recently update your Fish version?
from chruby-fish.
I just received a brand new mac (yesterday) and installed it all fresh via homebrew. Am at versions:
~ fish --version
fish, version 2.7.1
~ chruby --version
chruby: 0.3.9
chruby-fish: 0.8.1
It isn't working for me straight of the box anymore either.
I tested bash
again (as in my first post) and that does work. Are you at the same fish
version ? Not sure what else could be interfering.
PS: I might try and install fish 2.6.x
and see if that's what broke it ... if I can figure out how to do that easily. Smile. Unless you all are at 2.7.x. @databus23 - what version of fish are you using?
from chruby-fish.
I'm having the same issue. I'm almost certain it was working for me with fish 2.7.1, because I only switched to fish a few months ago, and 2.7.1 came out Dec 2017, which was before I switched. So unless the version had not been updated in homebrew by the time I switched to fish, I should have been running 2.7.1.
@thornomad It's interesting that you mention installing VMware Fusion, I also installed that yesterday, and today I just experienced the problem for the first time. I uninstalled VMware Fusion yesterday as well. I'm not sure what the VMware Fusion install could have done that would break this.
from chruby-fish.
Wow that ended up being it (for me) @thornomad. I'm glad you mentioned VMware, I never would have made that connection.
https://communities-gbot.vmware.com/thread/574038
I had to cd /etc/paths.d
and then sudo rm com.vmware.fusion.public
which removed the path addition, and fixed the problem for me.
from chruby-fish.
VMware Fusion injects a path with a space in the PATH environment variable. Maybe that is messing things up. I have fusion installed as well and itβs not working me. Havenβt tried removing it.
from chruby-fish.
Wow - glad we know what's causing it ... I wonder if it's the way chruby.sh
is handling the :
to space swapping when it is reading the $PATH
variable and creating a new one ... I can imagine an unexpected space could be throwing that off.
set bash_path (echo $PATH | tr ' ' ':')
That would likely break with a space in one of the path variables I would guess ...
from chruby-fish.
Could any of you having this problem show the (full, but with any sensitive paths scrambled, if you want) output of these three commands:
echo $PATH
printf '%s\n' $PATH
bash -c "printf '%s\n' \$PATH"
from chruby-fish.
@JeanMertz Here you go.
The third command output looks fishy...
>> echo $PATH
/Users/user/bin /Users/user/Development/go/bin /usr/local/bin /usr/local/sbin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /Applications/VMware Fusion.app/Contents/Public
>> printf '%s\n' $PATH
/Users/user/bin
/Users/user/Development/go/bin
/usr/local/bin
/usr/local/sbin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Applications/VMware Fusion.app/Contents/Public
>> bash -c "printf '%s\n' \$PATH"
/Users/user/bin:/Users/user/Development/go/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware
Fusion.app/Contents/Public
from chruby-fish.
Thanks @databus23. The first and second one are interesting. I'm guessing in your .fish
config, you have quotes around the VMWare Fusion path, like "/Applications/VMware Fusion.app/Contents/Public"
?
I think the easiest fix for this is to make this change in chruby.fish
:
- set bash_path (echo $PATH | tr ' ' ':')
+ set bash_path (string join ':' $PATH)
Could you see if that works as expected? The only problem is I don't know since when Fish supports the builtin string join
, but that's a problem for later.
from chruby-fish.
@JeanMertz I didn't put this Vmware path in my PATH manually. That is happening by installing VMware fusion 10 which drops a file in /etc/paths.d
:
>> cat /etc/paths.d/com.vmware.fusion.public
/Applications/VMware Fusion.app/Contents/Public
Unfortunately set bash_path (string join ':' $PATH)
does not seem to change anything.
Calling chruby 2.5.0
still silently fails (exit: 1) and leaves me with the system ruby.
( I verified with functions bchruby
that the change is loaded)
from chruby-fish.
I think I know what the problem is now:
when invoking this in chruby_use
bchruby 'chruby_use' $argv $args | read -l ch_ruby_root ch_rubyopt ch_gem_home \
ch_gem_path ch_gem_root ch_path \
ch_ruby_engine ch_ruby_version \
ch_status
the resulting whitespace in ch_path
is causing an "off by one" error when read
populates the variables. (Printing $ch_status
afterwards yields 2.5.0
)
from chruby-fish.
Played around a bit:
Setting this before calling bchruby 'chruby_use' $argv $args | read ...
seems to fix it in my case:
set -l args '; echo "$RUBY_ROOT;${RUBYOPT:-_};${GEM_HOME:-_};${GEM_PATH:-_};${GEM_ROOT:-_};$PATH;$RUBY_ENGINE;$RUBY_VERSION;$?"'
set -l IFS ";"
Not sure if ;
is the best separator or if this might break for other setups though.
from chruby-fish.
@databus23 could you show me the following output in your Fish shell?
$ echo $PATH | tr ' ' ':'
$ string join ':' $PATH
I suspect the first problem was that you'd end up with a string like:
/sbin:/Applications/VMware:Fusion.app/Contents/Public
Now you should end up with:
/sbin:/Applications/VMware Fusion.app/Contents/Public
But now we're onto the second problem, as you described.
from chruby-fish.
I created a PR to track the discovered problems. I think it makes most sense to continue the discussion there now that we know the root cause of the problem.
from chruby-fish.
I manually applied this PR and it fixed my issue (also likely due to VMware Fusion)
from chruby-fish.
Thanks for the pR @databus23 and for the validation @dwaite. I no longer actively develop in Ruby, so I haven't used chruby-fish
in a long time.
I'll reserve some time to merge the PR this weekend and do a new release. If that solves everything then π, if not, I might consider looking for someone to take stewardship of the project.
I haven't heard any other complaints besides this one though, so hopefully when this is fixed, we'll have a smooth couple of years ahead of us π
from chruby-fish.
Related Issues (20)
- Installing without brew HOT 1
- Fully set RUBIES doesn't match chruby output HOT 4
- "path component may not be valid" warning HOT 2
- wishlist: support for gem_home HOT 2
- Listing rubies also prints version
- Issue with GEM_PATH when using emacs robe HOT 1
- Add tests?
- Unknown commands with 0.7.1 HOT 9
- New release? HOT 2
- Prompt errors when no ruby version is specified for auto switching HOT 5
- fish-specific PATH changes get lost when changing ruby versions HOT 6
- chruby-fish executing .bash_profile when changing ruby HOT 1
- Permission issues on macosx
- test suite no longer working on latest macOS releases HOT 2
- tracking against chruby/auto.sh: chruby-fish defaults to system ruby when moving to a non-project directory
- chruby cannot successfully switch to mruby-3.0.0 under Fish
- Replace Travis CI with GitHub Actions HOT 1
- Consider using an org for this repo.
- Ruby is unselected when cd'ing out of a directory with a .ruby-version file HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chruby-fish.