The reason for introducing anyenv
is that I wanted to change the management of ruby from rbenv to the format of installing rbenv via anyenv. I also switched the version control of Node.js
from nodebrew
to nodenv
. This way you can keep your files clean as you only have to put the path of anyenv in .zshrc (.bash_profile for those who use bash).
I referred to this article . I also removed the packages that were globally installed with rm -rf .npm -global
. Here I also referred to the article .
I will install it with brew.
$ brew install anyenv
$ echo 'eval "$(anyenv init -)"' >> ~/.zshrc
$ exec $SHELL -l
$ anyenv install nodenv
$ exec $SHELL -l
Change the part of ~/.zshrc
according to the shell you are using. That's it!
anyenv-update
This provides a command called anyenv update
that allows you to update ~ env
including nodenv in bulk.
$ mkdir -p $(anyenv root)/plugins
$ git clone https://github.com/znz/anyenv-update.git $(anyenv root)/plugins/anyenv-update
The location of $ anyenv root
is directly under your home directory.
$ anyenv root
/Users/shuntagami/.anyenv
Below is my example when I run the anyenv update
command.
$ anyenv update
Skipping 'anyenv'; not git repo
Updating 'anyenv/anyenv-update'...
Updating 'nodenv'...
Updating 'nodenv/node-build'...
Updating 'nodenv/nodenv-default-packages'...
Updating 'nodenv/nodenv-vars'...
Updating 'rbenv'...
Updating 'rbenv/ruby-build'...
Updating 'tfenv'...
Updating 'anyenv manifest directory'...
nodenv-default-packages
It is a nodenv plugin that allows you to specify anyenv-update of the anyenv plugin and the packages to be installed together by default when installing npm.
$ mkdir -p $(anyenv root)/plugins
$ git clone https://github.com/znz/anyenv-update.git $(anyenv root)/plugins/anyenv-update
$ mkdir -p "$(nodenv root)"/plugins
$ git clone https://github.com/nodenv/nodenv-default-packages.git "$(nodenv root)/plugins/nodenv-default-packages"
$ touch $(nodenv root)/default-packages
Specify the packages you want to install in the contents of default-packages
default-packages
yarn
typescript
ts-node
typesync
$ nodenv install -l
$ nodenv install 15.4.0
$ nodenv global 15.4.0
I have installed the latest 15.4.0. Now, if you type node -v
and the installed version is included, you are successful!
Details of rbenv are summarized in this article . As with the installation of nodenv
, you need to uninstall rbenv
once.
$ anyenv install rbenv
$ rbenv install 2.6.5
$ rbenv global 2.6.5
Please change the version as appropriate. that's all!
I also deleted the rails command, so I reinstalled it.
$ gem install bundler
$ gem install rails --version='6.0.0'
Recommended Posts