- Author: rinrinne
- Repository: https://github.com/rinrinne/install-shared-rbenv
This script installs rbenv and ruby-build then build ruby. Those are stored into shared directory. All user can use them with a bit setting.
You need to install some libraries and commands for ruby-build. The below is package list for Ubuntu.
build-essential libncurses-dev libgdbm-dev libyaml-dev
tk-dev libreadline-dev zlib1g-dev libssl-dev libffi-dev
libssl1.0.0 git-core curl
You can use the below environment variables.
- RBENV_ROOT
- Install path for rbenv (default: /usr/local/rbenv)
- RBENV_VERSION
- Ruby version you want to install (default: 2.0.0-p247)
If you store them into .install
in current directory, This script reads it.
$ ./install-shared-rbenv
If you want to install into system directory, this should be run as root.
Without user setting
$ sudo cp dot.profile /etc/profile.d/Z99-rbenv.sh
$ sudo chmod a+x /etc/profile.d/Z99-rbenv.sh
Or setup by each users
$ cat dot.profile >> $HOME/.profile
In addition, rbenv wrapper named shared-rbenv
is generated into current directory. You can use it if you want to run rbenv itself.
$ ./shared-rbenv
You can move shared-rbenv
to any directory then run it.
$ RBENV_ROOT=/path/to/rbenv RBENV_VERSION=your-ruby-version; $RBENV_ROOT/bin/rbenv exec ruby SCRIPTFILE
- If you export
RBENV_ROOT
andRBENV_VERSION
, you can remove them from commnad line. - If you set default version using
rbenv global
, The above command line can be run withoutRBENV_VERSION
.
$ RBENV_ROOT=/path/to/rbenv RBENV_VERSION=your-ruby-version; sudo -E $RBENV_ROOT/bin/rbenv global $RBENV_VERSION
Or, run with shared-rbenv
$ ./shared-rbenv exec ruby SCRIPTFILE
$ sudo ./shared-rbenv global $RBENV_VERSION
bundle is already installed into shared ruby. So you can use gem via bundle.
If you don't use any profile settings, bundle can be run with the below command.
$ RBENV_ROOT=/path/to/rbenv RBENV_VERSION=your-ruby-version; $RBENV_ROOT/bin/rbenv exec bundle
Or run with shared-rbenv
$ ./shared-rbenv exec bundle
Same as install.
If RBENV_ROOT
is already exist as directory, install-shared-rbenv
will update rbenv and plugins then install ruby with RBENV_VERSION
.
At first, you should install once by default. Then you can run the below command to get available ruby versons.
$ ./shared-rbenv install -l
Mainly meaning of global.
In rbenv, global affects installed user, no effects to other users. But in share-rbenv, global affects installed system. It means that it affects all users.
If you want to apply global
same as rbenv, you should use local
at home directory.
MIT License.
Copyright (c) 2013 rinrinne a.k.a. rin_ne