Skip to content

Instantly share code, notes, and snippets.

@BrianPurgert
Created December 31, 2023 18:47
Show Gist options
  • Select an option

  • Save BrianPurgert/4f18dcbad5766eebba5d9379ac09e6e2 to your computer and use it in GitHub Desktop.

Select an option

Save BrianPurgert/4f18dcbad5766eebba5d9379ac09e6e2 to your computer and use it in GitHub Desktop.
install Ruby using RTX (asdf Rust clone)

Here's a guide for installing Ruby on Windows Subsystem for Linux (WSL) using rtx, a polyglot runtime manager:

  1. Install RTX: First, install rtx. You can do this by downloading the binary for Linux from the RTX releases page on GitHub. Choose the appropriate version for your system (e.g., rtx-latest-linux-x64 for 64-bit Linux).

    bashCopy code

    curl -L https://github.com/jdx/rtx/releases/download/latest/rtx-latest-linux-x64 > ~/bin/rtx chmod +x ~/bin/rtx

  2. Add RTX to PATH: Make sure that rtx is in your PATH. You can do this by adding the following line to your .bashrc or .zshrc:

    bashCopy code

    export PATH="$HOME/bin:$PATH"

  3. Activate RTX: To initialize rtx in your shell session, you need to add an activation command to your shell's configuration file. For Bash, add the following line to your .bashrc:

    bashCopy code

    eval "$(~/bin/rtx activate bash)"

    For Zsh, add it to your .zshrc.

  4. Install Ruby Using RTX: Now, you can use rtx to install Ruby. Specify the version you want to install. For example, to install Ruby version 2.7.2:

    cssCopy code

    rtx install ruby@2.7.2

  5. Set Ruby Version: After installing, set the Ruby version for your project or globally. To set it for the current directory:

    perlCopy code

    rtx use ruby@2.7.2

    To set it globally (for all directories), use:

    cssCopy code

    rtx use --global ruby@2.7.2

  6. Verify Installation: Finally, verify the installation by checking the Ruby version:

    undefinedCopy code

    ruby -v

This should install Ruby on your WSL environment using rtx. Remember to replace 2.7.2 with the version of Ruby you need.

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