Madogiwa Blog

主に技術系の学習メモに使っていきます。

rbenv+nodebrewからasdfに移行したので作業メモ📝

rbenv+nodebrewからasdfに移行してみたのでやったことをメモしておきます📝

github.com

asdfインストール

公式はgit cloneの方法のようだが、homebrewからinstallできるようなのでinstall

https://asdf-vm.com/guide/getting-started.html#_2-download-asdf

$ brew install asdf

以下に従ってbrew + zshのinstallコマンドを実行 https://asdf-vm.com/guide/getting-started.html#_3-install-asdf

$ echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ${ZDOTDIR:-~}/.zshrc

出来た🆗

$ asdf --version
v0.13.1

asdfrubyを管理

asdfruby pluginを追加

$ asdf plugin add ruby 

install可能なrubyのバージョンを確認

$ asdf list-all ruby

任意のバージョンのrubyのinstall

$ asdf install ruby 3.2.2

任意のバージョンのrubyのグローバル利用

$ asdf global ruby 3.2.2

出来た🆗

$ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin22]

rbenv uninstall

rbenvは不要なので削除しておく

$ brew uninstall rbenv
$ rm -rf ~/.rbenv 

.zshrcから以下も削除

# for rbenv
eval "$(rbenv init - zsh)"

asdfでnodeを管理

asdfのnodeプラグインを追加

$ asdf plugin add nodejs 

インストール可能なnodeの一覧を表示

$ asdf list-all nodejs

任意のバージョンのnodeをinstall

$ asdf install nodejs 18.18.2

任意のバージョンのnodeをグローバル利用

$ asdf global nodejs 18.18.2

出来た🆗

$ node -v
v18.18.2

nodebrew uninstall

$ brew uninstall nodebrew
$ rm -rf ~/.nodebrew 

.zshrcから以下も削除

# for nodebrew
export PATH=$HOME/.nodebrew/current/bin:$PATH

参考

scrapbox.io

https://asdf-vm.com/guide/getting-started.html#_4-install-a-plugin