Comments (28)
Looking at this similar rbenv issue, did you restart tmux after configuring chruby?
from chruby.
Also ensure that tmux is creating shells that are login/interactive (-l
option).
from chruby.
Yes, I did restart tmux after configuring it. Starting tmux with the -l
flag does not help.
from chruby.
Also is this happening in one tmux window, or between multiple ones?
from chruby.
It happens in all tmux windows. I noticed that all env variables are set by chruby, except the PATH.
from chruby.
Working here with the following in my .profile
source profile.d/chruby
RUBIES=(/home/gibheer/src/rubinius)
chruby rubinius
This is on an archlinux and freebsd with tmux and zsh.
from chruby.
Reproduced same issue as donpinkster with OS X, tmux and zsh. Sourcing chruby.sh and .zshrc from within tmux didn't fix.
from chruby.
Switch .zshrc sourcing of chruby to latest from readme, and now tmux works in first screen and new screens.
source /usr/local/share/chruby/chruby.sh
from chruby.
I have been digging around and found out the problem was on my side. Somewhere in my config I had the following:
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin
Changing that to
export PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin
fixed the problem. Stupid mistake 😄
from chruby.
Ah ha!
from chruby.
For those experiencing similar issues: I managed to solve this issue by running chruby_reset
before specifying the default version in my .bashrc file.
from chruby.
@yorickpeterse Interesting. chruby_use
calls chruby_reset
if a Ruby has already been selected.
from chruby.
Interesting bit: it works fine on my Xubuntu installation (without calling chruby_reset
) yet on my Arch Linux installation it is required. This leads me to believe it might be an issue with recent versions of Tmux as my Xubuntu installation uses Tmux 1.6 while my Arch Linux installation uses 1.7.
from chruby.
@yorickpeterse are you sure you have nothing else in your .profile
or .zshrc
? I'm using tmux 1.7 and zsh and don't experience any problems. Maybe something from /etc/profile.d/ does an override for you?
from chruby.
@yorickpeterse @Gibheer another possibility is Arch modified /etc/zshrc
or /etc/zprofile
. I can confirm that Fedora did modify /etc/zshrc.
from chruby.
Considering I'm running Bash and not Zsh, wouldn't that mean those files are never loaded to begin with?
from chruby.
@yorickpeterse ah, than you would want to check /etc/bashrc
, /etc/profile
and ~/.bashrc
.
from chruby.
@donpinkster @postmodern @yorickpeterse I've just been investigating this issue on OS X with tmux 1.7 and chruby 0.2.5.
I also reset my PATH
in ~/.zshenv
(/etc/paths
on OS X puts /usr/local
at the end, which I'm not a fan of). It seems that when I start a new terminal window, chruby sets the default ruby correctly, but when a new tmux session is started $RUBY_ROOT
is already in the environment, so the short circuit check in chruby_use
passes and the chruby_reset
is never called.
Adding a call to chruby_reset
before setting the default version in ~/.zshenv
does indeed solve the problem. But it seems to me that calling chruby_use
should always call chruby_reset
if $RUBY_ROOT
is set to ensure a clean environment, and just remove the short circuit altogether.
What do you think?
from chruby.
I can confirm that removing the short circuit check makes chruby work out of the box with tmux using the README instructions.
from chruby.
As a workaround, should we call chruby_reset
when loading share/chruby/chruby.sh
?
from chruby.
Yea I like that, seems like a good solution. Just made the change locally and it works as expected.
Thanks for your work @postmodern, chruby is an awesome piece of software.
from chruby.
Changed in master. Please test master to confirm the fix.
from chruby.
Confirmed working. 👍
from chruby.
@hecticjeff Upon further thought, you should not be overriding your PATH
, but instead use shell String manipulating to remove /usr/local
from PATH
, and insert it before /usr
. This would preserve chruby's modifications to PATH
.
Also, I realized that by calling chruby_reset
, it makes it impossible to change Rubies and then spawn a sub-shell that uses the same Ruby.
from chruby.
@hecticjeff but you do make a convincing argument for the removal of the short circuit. PATH
or GEM_PATH
could be modified by another program, which might require the user to reset the environment by calling chruby
again.
from chruby.
@postmodern Approved! ❤️
from chruby.
👍 Nice work
from chruby.
All new features have been merged into the 0.3.0 branch. Feels like 0.3.0 isn't far off, so maybe this fix will be released in 0.3.0 instead of 0.2.6.
from chruby.
Related Issues (20)
- Add safe local bin directory to PATH HOT 4
- Filter out rubies that lack a bin/ruby file
- chruby reports exit status 0 under Bash, but still throws a Ruby exception when switching to mruby HOT 1
- `setup.sh` script is broken on WSL2 Ubuntu 20.04 HOT 1
- Integrate with vscode HOT 2
- Won't able to remove chruby from MacOS Shell HOT 5
- Cannot install latest ruby through chruby on Mac M2 Apple Chip HOT 1
- "chruby: unknown Ruby: ruby-3.1.2" was shown everytime launch terminal HOT 4
- Wrong $PATH in Nova Editor process
- Is there a deterministic way of checking whether bundle exec is necessary? HOT 5
- Release 0.4.0
- Chruby puts a missing directory on the PATH HOT 2
- Rename `share/chruby/dev.sh` to `share/chruby/testing.sh` (or other) HOT 7
- chruby not available system-wide HOT 1
- Unable to install on macOS 12.6.7 HOT 2
- yaourt alternative needed HOT 1
- Wiki instructions for Ruby.md - move to 3.3.0 HOT 1
- [Wiki] Incorrect wget path for Ruby install HOT 1
- chruby picking the wrong ruby on substring match HOT 3
- Non-interactive `chruby-exec` fails with `zsh:1: command not found: chruby` HOT 4
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.