You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法重新安装Ruby至最新版本,终端无法识别Ruby命令求助

Fixing Ruby Command Not Found After Installing Ruby2.3

Hey, let's work through this Ruby issue step by step. I've run into similar problems on Debian/Ubuntu-based systems before, so here's what you can try:

  • First, confirm where Ruby 2.3 is actually installed
    The apt package manager might have installed Ruby 2.3 to a version-specific path instead of creating a generic ruby alias. Run this command to list all files from the ruby2.3 package:

    dpkg -L ruby2.3
    

    Look for a line like /usr/bin/ruby2.3 — that's the actual executable file.

  • Create a symbolic link to make the ruby command work
    If you found /usr/bin/ruby2.3, create a soft link from this file to /usr/bin/ruby (which is in your system's default PATH):

    sudo ln -s /usr/bin/ruby2.3 /usr/bin/ruby
    

    Do the same for the gem command if you need it:

    sudo ln -s /usr/bin/gem2.3 /usr/bin/gem
    
  • Verify the fix
    Run these commands to check if everything works as expected:

    ruby --version
    gem --version
    

    You should see Ruby 2.3's version number pop up now.

  • If the above doesn't work, try reinstalling the packages
    Sometimes the installation might have missed creating necessary links. Reinstall both the version-specific package and the generic ruby meta-package:

    sudo apt-get update
    sudo apt-get install --reinstall ruby2.3 ruby
    

    The ruby meta-package is supposed to point to the default Ruby version on your system, so this might automatically set up the correct links for you.

  • Double-check your PATH (just in case)
    Even though which ruby returned nothing, confirm that /usr/bin is in your PATH:

    echo $PATH
    

    If /usr/bin isn't listed, you can add it temporarily with export PATH=$PATH:/usr/bin, or permanently by adding that line to your ~/.bashrc or ~/.profile file.


内容的提问来源于stack exchange,提问作者Priya

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 04:03:45