Skip to content

Instantly share code, notes, and snippets.

@RedenticDev
Last active February 3, 2021 10:59
Show Gist options
  • Select an option

  • Save RedenticDev/2c71869492ba2740a3725216898c522a to your computer and use it in GitHub Desktop.

Select an option

Save RedenticDev/2c71869492ba2740a3725216898c522a to your computer and use it in GitHub Desktop.

Revisions

  1. RedenticDev revised this gist Feb 3, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Steps.md
    Original file line number Diff line number Diff line change
    @@ -22,6 +22,8 @@ rvm upgrade ruby <version> --with-libyaml-dir=$(brew --prefix libyaml) --with-op
    ```
    `<version>` is obviously the version of Ruby you want to install. Check [Ruby's site](https://www.ruby-lang.org/en/downloads/) to pick a version. I personally chose 2.7.2.

    In case of problems, you can `rvm remove ruby` and run the same command as above starting with `rvm install` instead of `upgrade`.

    You can check your new version by running:
    ```sh
    ruby -v
  2. RedenticDev created this gist Feb 3, 2021.
    36 changes: 36 additions & 0 deletions Steps.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    ## Why?
    Because Homebrew's Ruby cannot overwrite the system's Ruby, and you might need to update macOS native Ruby for some gems.

    ## Prerequisite
    - [Homebrew](https://brew.sh), because it can manage updates on Ruby dependencies super easily. Keep in mind that you can do without it, but that's how I did it.

    ## Let's update
    Before updating, save somewhere your installed gems, because something could go wrong, or a compatibility issue could occur, deleting all your gems. You can do it by simply running:
    ```sh
    gem query --local
    ```
    You can pipe the output into a file for example, with the `>` operand (Google it if you don't know how to use shell).

    Then, install these packages with Homebrew:
    ```sh
    brew install libyaml openssl
    ```

    Finally, the update command:
    ```sh
    rvm upgrade ruby <version> --with-libyaml-dir=$(brew --prefix libyaml) --with-openssl-dir=$(brew --prefix openssl)
    ```
    `<version>` is obviously the version of Ruby you want to install. Check [Ruby's site](https://www.ruby-lang.org/en/downloads/) to pick a version. I personally chose 2.7.2.

    You can check your new version by running:
    ```sh
    ruby -v
    ```
    That's it!

    ## Warning!
    You might need to downgrade `rvm` if the command above doesn't work. To do so, run:
    ```sh
    rvm get 1.27.0
    ```
    This version of `rvm` is pretty stable AFAIK. However, it doesn't support latest versions of Ruby (3.0.0). Run again the command above after the downgrade.