Skip to content

Instantly share code, notes, and snippets.

@anaarezo
Last active October 24, 2023 10:22
Show Gist options
  • Save anaarezo/8cbd3fabbda476ca478bd625d0011d07 to your computer and use it in GitHub Desktop.
Save anaarezo/8cbd3fabbda476ca478bd625d0011d07 to your computer and use it in GitHub Desktop.
Ruby Update Version - Issues of unlinked version

If you've updated Ruby on your Mac to version 2.7.7 but ruby -v still shows version 2.6.10, it's possible that you have multiple versions of Ruby installed on your system, and the system is still using the older version. You can follow these steps to ensure you're using the correct Ruby version:

  1. Check your Ruby versions: First, make sure that Ruby 2.7.7 is installed on your system. You can check this by running the following command:

    ruby -v

    If it shows the wrong version (2.6.10), it means that the system is using the older Ruby version.

  2. Use a Ruby version manager (like RVM or rbenv): Ruby version managers allow you to switch between different Ruby versions easily and manage gems separately for each Ruby version. You can choose between RVM or rbenv; I'll provide instructions for rbenv here:

    a. Install rbenv: If you haven't already installed rbenv, you can do so using Homebrew:

    brew install rbenv

    b. Initialize rbenv: Add rbenv to bash so that it loads every time you open a terminal:

    echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.zshrc

    Restart your terminal or run source ~/.zshrc to apply the changes.

    c. Install Ruby 2.7.7 with rbenv: Install Ruby 2.7.7 using rbenv:

    rbenv install 2.7.7

    d. Set Ruby 2.7.7 as the default version: Set Ruby 2.7.7 as the global version:

    rbenv global 2.7.7

    e. Verify your Ruby version: Check if the correct Ruby version is now in use:

    ruby -v

    It should show Ruby 2.7.7.

  3. Troubleshooting: If you still see the wrong Ruby version, it's possible that you have conflicting paths or other issues with your system. You may need to investigate further to resolve the problem. Double-check your shell startup files (e.g., .zshrc, .bashrc, or .bash_profile) for any other references to Ruby or paths.

By using a Ruby version manager like rbenv, you can easily switch between different Ruby versions and manage them without interfering with the system's Ruby installation.

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