rsvmでRustのバージョン管理を試してみた

rsvmでRustのバージョン管理を試してみた

言語のバージョン管理でいう〜env系のRust版があったので試して見た

github.com

環境

rsvmをインストールする

$ curl -L https://raw.github.com/sdepold/rsvm/master/install.sh | sh

これでパスも通ったはずなので更新して確認、試しにヘルプを出してみる

$ source .zshrc
$ rsvm -h

下記のように出てれば成功

Rust Version Manager
====================

Usage:

  rsvm help | --help | -h       Show this message.
  rsvm install <version>        Download and install a <version>.
                                <version> could be for example "0.12.0".
  rsvm uninstall <version>      Uninstall a <version>.
  rsvm use <version>            Activate <version> for now and the future.
  rsvm ls | list                List all installed versions of rust.
  rsvm ls-remote                List remote versions available for install.
  rsvm ls-channel               Print a channel version available for install.

Current version: 0.5.1

rsvmでrustを入れてみる

どのバージョンを入れて良いのか分からないのでRustのバージョンを確認する

$ rsvm ls-remote

現在の最新が1.14.0であることが分かるので指定してインストールする

rsvm install 1.14.0

以下のように表示されたら完了

Creating the respective folders for rust 1.14.0 ... done
Downloading sources for rust 1.14.0 ...
######################################################################## 100.0%
Extracting source ... done
Downloading sources for rustc sourcecode 1.14.0 ...
######################################################################## 100.0%
Extracting source ... install: creating uninstall script at /Users/moaible/.rsvm/versions/1.14.0/dist/lib/rustlib/uninstall.sh
install: installing component 'rustc'
install: installing component 'rust-std-x86_64-apple-darwin'
install: installing component 'rust-docs'
install: installing component 'cargo'

    Rust is ready to roll.


And we are done. Have fun using rust 1.14.0.
Activating rust 1.14.0 ... done

指定したバージョンがインストールされたかを確認

$ rsvm ls
rsvm_initialize:23: file exists: /Users/moaible/.rsvm/.rsvm_version
Installed versions:

  =>  1.14.0

$ rustc -V
rustc 1.14.0 (e8a012324 2016-12-16)

Rustのバージョンも反映されてることが分かる

疑問

他の〜env系と違ってlocalglobalの切り替えができない模様、nvmとインターフェースが似てるのでどうにか解決できるかもしれない

終わりに

他の言語と同じようにRustでもバージョン管理することができたので、どんどんRustを追いかけていきたい