Skip to content

Make RUBIES a colon-delimited string instead of an array - #508

Draft
kbrock wants to merge 1 commit into
postmodern:masterfrom
kbrock:noarrays
Draft

Make RUBIES a colon-delimited string instead of an array#508
kbrock wants to merge 1 commit into
postmodern:masterfrom
kbrock:noarrays

Conversation

@kbrock

@kbrock kbrock commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Motivation

Fix chruby in Claude using bash.

RUBIES is not ending up in subshells, so chruby environments are wonky in Claude.
You have to essentially source /usr/local/share/chruby.sh ; chruby 4.0 ; ruby

TMI

Claude copies all functions and sets them into a subshell (not via sourcing .bashrc)
So functions that get defined in chruby.sh will end up in subshells.

It inherits environmental variables via the typical export mechanism.
So if you do not export ENV, then that will not be in shells - this is an issue.
Array ENV variables can not be export-ed - this is an issue.

Our issue: RUBIES is not exported and it can't be exported because it is an array.
Solution is to not define RUBIES (v1.0) or to define RUBIES as a string (this PR)

Before

RUBIES was a bash array, and bash arrays cannot be exported. So every fresh subshell — including every Claude Code Bash tool call — started with an empty RUBIES and chruby failed to resolve any Ruby version, even though RUBY_ROOT, GEM_HOME, and PATH were already set correctly in that same subshell.

After

RUBIES is exported as a colon-delimited string, like PATH, so chruby resolves correctly in any subshell, including Claude's. One side effect: RUBIES now shows up in every child process's environment (e.g. in env output), which it never did as an array.

Motivation
---
Fix chruby in Claude. Core issue is RUBIES is not set in claude shells.

Before
---
RUBIES was a bash array, and bash arrays cannot be exported. So every
fresh subshell — including every Claude Code Bash tool call — started
with an empty RUBIES and chruby failed to resolve any Ruby version,
even though RUBY_ROOT, GEM_HOME, and PATH were already set correctly
in that same subshell.

After
---
RUBIES is exported as a colon-delimited string, like PATH, so chruby
resolves correctly in any subshell, including Claude's. One side
effect: RUBIES now shows up in every child process's environment
(e.g. in `env` output), which it never did as an array.
@kbrock

kbrock commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

punting. think the solution is to go with chruby-list from 1.0.

the catch is chruby-list still uses an array, which breaks in much the same way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant