Install Latest Stable Version of Ruby Using rbenv

后端 未结 6 915
星月不相逢
星月不相逢 2020-12-24 02:07

I want to install the latest stable version of Ruby available with rbenv. This feature won\'t be happening in rbenv itself.

When I run the command rbenv instal

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-24 02:39

    Simple solution (directly installs latest stable version):

    rbenv install $(rbenv install -l | grep -v - | tail -1)
    

    Explanation:

    rbenv install -l | grep -v - | tail -1
    

    Filters out all versions that contain a hyphen -, which is all non-MRI versions and prerelease MRI versions. Then selects the last one, guaranteed to be the highest because ruby-build output is already sorted by version number ascending.

提交回复
热议问题