PROBLEM
While pulling theme changes, I see a warning the "environment Ruby version is outside of the range supported by the CLI".
- Shopify CLI 2.11.2
- Ruby 2.6.3
- Homebrew 3.3.15
- Mac OSX 11.6.1
THINGS TRIED
- Googling has revealed many conflicting (and out-of-date) answers about how to update Ruby on OSX.
- Have been through all 11 pages of this extensive guide but can’t find basic, 1-2-3 instructions for how to switch to Homebrew Ruby without a version manager: Install Ruby 3.1 ยท macOS (is it really this complex?)
- Have also updated Brew/Shopify CLI and also tried updating Ruby via Brew
using…
$ brew upgrade ruby
But saw another warning…
Warning: ruby 3.1.0 already installed
So assume the OSX version of Ruby is overriding the brew version? Not sure, I have zero Ruby knowledge sorry.
QUESTIONS
- What’s best Ruby setup (and way to update Ruby) specifically for use with Shopify CLI
on OSX 11 – especially when you don’t do any other Ruby development?
Any help or suggestions welcome. Cheers
2
Answers
Switching to Homebrew Ruby requires you update the PATH environment variable (zsh shell in OSX11 instead of bash) by running...
$ echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc
I still see a Shopify warning that Ruby 3.1.0 is outside the range supported by the CLI but assume that's a Shopify issue because this page states a requirement of Ruby 2.7+.
Had a problem today configuring shopify-cli, especially to run
shopify theme pull
which was giving an error and never concluding the pull.From the researches I have done, found that for the best use of shopify-cli you must use ruby 3.0.0 and node above version 14.
For changing Ruby versions I suggest you install RBENV, many people claim that RVM is the best choice but seasoned rubyists have told me that that RVM is sharp and smart but it all goes through the window when it ditches you on the road and you spend several hours trying to fix it, so my call it RBENV to manage your versions.
Some work around may be done on the zshrc file as mentioned in the above comment