In my case, I write and execute code in multiple languages in my development environment. For example, perl, ruby, nodejs, python. To use these, I used plenv, rbenv, nodebrew, pyenv, etc.
However, I heard that there is something called anyenv, so I switched to this one.
** People who use more than one env should use this. Recommended.
If you follow README.md, it's OK.
$ git clone https://github.com/riywo/anyenv ~/.anyenv
zshrc has become simpler!
# ------------------------------------------------------------------------
-# plenv
+# anyenv
# ------------------------------------------------------------------------
-if [ -d ${HOME}/.plenv ] ; then
- export PATH=${HOME}/.plenv/bin:${HOME}/.plenv/shims:${PATH}
- eval "$(plenv init -)"
-fi
-
-# ------------------------------------------------------------------------
-# rbenv
-# ------------------------------------------------------------------------
-if [ -d ${HOME}/.rbenv ] ; then
- export PATH=$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH
- #export PATH="$HOME/.rbenv/bin:$PATH"
- eval "$(rbenv init -)"
-fi
-
-# ------------------------------------------------------------------------
-# nodebrew
-# ------------------------------------------------------------------------
-if [ -d ${HOME}/.nodebrew ] ; then
- export PATH=${HOME}/.nodebrew/current/bin:${PATH}
-fi
-
-# ------------------------------------------------------------------------
-# pyenv
-# ------------------------------------------------------------------------
-# git://github.com/yyuu/pyenv.git
-if [ -d ${HOME}/.pyenv ] ; then
- export PATH="$HOME/.pyenv/bin:$PATH"
- eval "$(pyenv init -)"
+if [ -d $HOME/.anyenv ] ; then
+ export PATH="$HOME/.anyenv/bin:$PATH"
+ eval "$(anyenv init -)"
fi
I wish I knew earlier ...
--If you don't pass the PATH to shims, it seems that you will see system after starting tmux. ――Therefore, it seems that the following differences are necessary.
if [ -d ${HOME}/.anyenv ] ; then
export PATH="$HOME/.anyenv/bin:$PATH"
eval "$(anyenv init -)"
+ for D in `ls $HOME/.anyenv/envs`
+ do
+ export PATH="$HOME/.anyenv/envs/$D/shims:$PATH"
+ done
+
fi
reference
-[Troubleshooting that * env / shims is read before system PATH and system is used by anyenv (* env) in tmux](http://monmon.hateblo.jp/entry/2013/12/13 / 233242)
anyenv install
The following is a memo when installing.
Install ** env corresponding to ruby, perl, python, node.js.
$ anyenv install rbenv
$ anyenv install plenv
$ anyenv install pyenv
$ anyenv install ndenv
I think that the initial state points to the system as shown below.
$ anyenv versions
ndenv:
* system (set by /Users/luckypool/.anyenv/envs/ndenv/version)
plenv:
* system (set by /Users/luckypool/.anyenv/envs/plenv/version)
pyenv:
* system (set by /Users/luckypool/.anyenv/envs/pyenv/version)
rbenv:
* system (set by /Users/luckypool/.anyenv/envs/rbenv/version)
So, install from the familiar ** env.
$ rbenv install 2.1.0
$ plenv install 5.16.3
$ ndenv install v0.10.25
$ pyenv install 2.7.6
$ pyenv install 3.3.3
It will take some time for each, but if it is installed properly, it will be as follows.
$ anyenv versions
ndenv:
system
* v0.10.25 (set by /Users/luckypool/.anyenv/envs/ndenv/version)
plenv:
* system (set by /Users/luckypool/.anyenv/envs/plenv/version)
5.16.3
pyenv:
* system (set by /Users/luckypool/.anyenv/envs/pyenv/version)
2.7.6
3.3.3
rbenv:
* system (set by /Users/luckypool/.anyenv/envs/rbenv/version)
2.1.0
So, set global to point to the installed version.
rbenv global 2.1.0
plenv global 5.16.3
ndenv global v0.10.25
pyenv global 3.3.3
It has changed!
$ anyenv versions
ndenv:
system
* v0.10.25 (set by /Users/luckypool/.anyenv/envs/ndenv/version)
plenv:
system
* 5.16.3 (set by /Users/luckypool/.anyenv/envs/plenv/version)
pyenv:
system
2.7.6
* 3.3.3 (set by /Users/luckypool/.anyenv/envs/pyenv/version)
rbenv:
system
* 2.1.0 (set by /Users/luckypool/.anyenv/envs/rbenv/version)
You can check it if necessary, but it's easy to forget, so check the following as well.
Insert bundler for ruby code.
$ which gem
/Users/luckypool/.anyenv/envs/rbenv/shims/gem
$ gem install bundler
$ which bundle
/Users/luckypool/.anyenv/envs/rbenv/shims/bundle
Put cpanm and carton for perl code.
$ plenv install-cpanm
$ cpanm Carton
$ which carton
$ /Users/luckypool/.anyenv/envs/plenv/shims/carton
Make sure that pip and npm are also in your PATH.
$ which pip
/Users/luckypool/.anyenv/envs/pyenv/shims/pip
$ which npm
/Users/luckypool/.anyenv/envs/ndenv/shims/npm
that's all!
Recommended Posts