oneclick / rubyinstaller2

MSYS2 based RubyInstaller for Windows
https://rubyinstaller.org
BSD 3-Clause "New" or "Revised" License
645 stars 248 forks source link

`ridk use tool` doesn't work. #314

Closed Vucius closed 1 year ago

Vucius commented 1 year ago

ridk use tool doesn't work.

I installed ruby2.7.6 with DEVKIT via rubyinstaller-devkit-2.7.6-1-x64.exe. And then installed ruby3.0.2 via rubyinstaller-3.0.2-1-x64.exe. But, I found I couldn't switch back to ruby2.7.6 via ridk ues cmd information:

$ ridk version
---
ruby:
  path: X:/Ruby/Ruby30-x64
  version: 3.0.2
  platform: x64-mingw32
  cc: gcc.exe (Rev5, Built by MSYS2 project) 10.3.0
ruby_installer:
  package_version: 3.0.2-1
  git_commit: 80c9ca9
msys2:
  path: X:\Ruby\msys64
cc: gcc (Rev5, Built by MSYS2 project) 12.2.0
sh: GNU bash,版本 5.1.16(2)-release (x86_64-pc-msys)
os: Microsoft Windows [�汾 10.0.19044.2006]

$ ridk disable

$ ridk use
1 - X:/Ruby/Ruby27-x64  ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x64-mingw32]
2 - X:/Ruby/Ruby30-x64  ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x64-mingw32]
Select ruby version to enable: 1
Disable X:/Ruby/Ruby27-x64
Disable X:/Ruby/Ruby30-x64
Enable X:/Ruby/Ruby27-x64

$ idk enable

$ ruby -v
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x64-mingw32]

And then, I closed cmd.exe, and open a new one cmd information:

$ ruby -v
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x64-mingw32]

I did those thing on another computer, it performed same.

larskanis commented 1 year ago

ridk use is always only for the current shell. It's meant to quickly switch between different ruby versions or to run different projects with a dedicated ruby version.

The permanent switch between ruby versions is through the PATH environment variable in the Windows system settings. Just change the path from X:/Ruby/Ruby30-x64 to X:/Ruby/Ruby27-x64 there or drop multiple entries if there are any.

I still have some parameter in mind, that makes the switch permanent (like ridk use --default or so), but so far this isn't implemented.

Vucius commented 1 year ago

ridk use is always only for the current shell. It's meant to quickly switch between different ruby versions or to run different projects with a dedicated ruby version.

The permanent switch between ruby versions is through the PATH environment variable in the Windows system settings. Just change the path from X:/Ruby/Ruby30-x64 to X:/Ruby/Ruby27-x64 there or drop multiple entries if there are any.

I still have some parameter in mind, that makes the switch permanent (like ridk use --default or so), but so far this isn't implemented.

Now i know how to swith different ruby.thank u

mohits commented 1 year ago

I find using pik a simple way to run using different Ruby versions on Windows, and wrote about it here: https://notepad.onghu.com/2021/ruby3-windows-pik-multiple-installations/