# Install chruby with Homebrew, MacPorts, Nix

Ruby environment tool. Version 0.3.9 via Homebrew; verified from local package data.

## Install

```sh
sudo av install brew:chruby
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install chruby
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install chruby
```

  Evidence: MacPorts ports tree: ruby/chruby/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#chruby
```

  Evidence: nixpkgs package indexes: chruby from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix

## Package facts

- **Package key:** brew:chruby
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/chruby>
- **Version:** 0.3.9
- **Source summary:** Ruby environment tool
- **Homepage:** <https://github.com/postmodern/chruby>
- **Repository:** <https://github.com/postmodern/chruby>
- **Upstream docs:** <https://github.com/postmodern/chruby#readme>
- **License:** MIT
- **Source archive:** <https://github.com/postmodern/chruby/releases/download/v0.3.9/chruby-0.3.9.tar.gz>
- **Generated:** 2026-07-08T07:18:31+00:00

## Executables

- chruby-exec (cli)
- chruby-exec (alias)

## Install behavior

- Post-install hook: not defined
- Caveats: Add the following to the ~/.bash_profile or ~/.zshrc file: source $HOMEBREW_PREFIX/opt/chruby/share/chruby/chruby.sh To enable auto-switching of Rubies specified by .ruby-version files, add the following to ~/.bash_profile or ~/.zshrc: source $HOMEBREW_PREFIX/opt/chruby/share/chruby/auto.sh
- Bottle: available on all

## Freshness

- Page generated: 2026-07-08
- Package-manager version: 0.3.9
- Local data: ok
- Upstream repository: https://github.com/postmodern/chruby
- info: No package-manager update timestamp was available.
- info: No cached GitHub release or tag data was available.
## Project history and usage

chruby is a minimal shell-based Ruby version switcher that changes the active Ruby by updating shell environment variables instead of using shims.

### Project history

The GitHub repository was created in August 2012 and early tags begin with v0.0.1 on the same date. The README highlights a deliberately small design: update PATH and RubyGems environment variables, support bash and zsh, default to system Ruby, and keep the implementation around 100 lines.

chruby's README frames its design through anti-features: it does not hook cd by default, does not install executable shims, does not regenerate shims after gem installation, and does not require Rubies to live in the user's home directory.

### Adoption history

The official README documents Homebrew installation, source installation, Arch AUR, Fedora Copr, FreeBSD ports, and pairing with ruby-install or ruby-build. The supplied package facts also show Homebrew, MacPorts, and Nix packaging.

### How it is used

Users source chruby.sh from shell startup files and optionally source auto.sh to switch versions by reading .ruby-version files in the current or parent directories. Non-standard Ruby install directories can be appended to the RUBIES shell array.

### Why package nerds care

chruby matters because it is the small-tool answer to heavier Ruby version managers. It plays well with package managers because it separates installing Ruby builds from selecting one in the shell, which keeps version switching inspectable and avoids shim directories.

### Timeline

- 2012: Repository created and v0.0.1 tag published.
- 2012: v0.1.x releases established the shell-based switcher.
- 2013: v0.3.x line matured around auto-switching and compatibility.
- 2023: v0.3.9 released.
- 2025: Repository metadata shows continued maintenance activity.

### Related projects

- Related projects include ruby-install, ruby-build, RVM, rbenv, rbfu, RubyGems, Bundler, JRuby, Rubinius, and MagLev.

### Sources

- <https://github.com/postmodern/chruby#readme>
- <https://api.github.com/repos/postmodern/chruby>
- <https://api.github.com/repos/postmodern/chruby/tags>
- <https://api.github.com/repos/postmodern/chruby/releases>


## Security Notes

narrow executable package without higher-risk signals.

- **Geiger risk:** green / low
- narrow executable package without higher-risk signals


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: ~/.bashrc, ~/.zshrc, /etc/bashrc, /etc/profile.d/chruby.sh, ~/.bash_profile, ~/.zprofile, .ruby-version, ~/.ruby-version
## Source Database Details

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** chruby
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

## Other Package-Manager Records

- Nix - chruby: normalized package name match | nixpkgs package indexes: chruby from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix
- MacPorts - chruby: normalized package name match | MacPorts ports tree: ruby/chruby/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## Related links

- [Source-control packages](https://www.automicvault.com/pkg/source-control-tools/) - Belongs to a source-control command family.
- [Package publisher tools](https://www.automicvault.com/pkg/package-publishers/) - Belongs to a package publishing or registry command family.
- [Terminal utility packages](https://www.automicvault.com/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://www.automicvault.com/pkg/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [ry](https://www.automicvault.com/pkg/brew/ry/) - Shares av.db curated category or tags: cli, developer-tools, ruby, shell.
- [rbenv](https://www.automicvault.com/pkg/brew/rbenv/) - Shares av.db curated category or tags: cli, developer-tools, ruby.
- [rbenv-binstubs](https://www.automicvault.com/pkg/brew/rbenv-binstubs/) - Shares av.db curated category or tags: cli, developer-tools, ruby.
- [rbenv-bundler-ruby-version](https://www.automicvault.com/pkg/brew/rbenv-bundler-ruby-version/) - Shares av.db curated category or tags: cli, developer-tools, ruby.
- [rbenv-ctags](https://www.automicvault.com/pkg/brew/rbenv-ctags/) - Shares av.db curated category or tags: cli, developer-tools, ruby.
- [rbenv-gemset](https://www.automicvault.com/pkg/brew/rbenv-gemset/) - Shares av.db curated category or tags: cli, developer-tools, ruby.
- [rbenv-vars](https://www.automicvault.com/pkg/brew/rbenv-vars/) - Shares av.db curated category or tags: cli, developer-tools, ruby.
- [rbspy](https://www.automicvault.com/pkg/brew/rbspy/) - Shares av.db curated category or tags: cli, developer-tools, ruby.

## Combined YAML source

View the package source record on GitHub. [combined/chruby.yml](https://github.com/automic-vault/db/blob/main/combined/chruby.yml)


## Sources

- Nucleus package database
- Geiger risk classifier
- package-page enrichment
- curated configuration and credential file locations
- curated package history
- package version freshness
- av.db category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
