The command rbenv install is missing
RubyUbuntuRbenvUbuntu 10.04Ruby Problem Overview
In Ubuntu 10.04
I just installed rbenv
.
The install command is not present.
rbenv 0.4.0-49-g8b04303
Usage: rbenv <command> [<args>]
Some useful rbenv commands are:
commands List all available rbenv commands
local Set or show the local application-specific Ruby version
global Set or show the global Ruby version
shell Set or show the shell-specific Ruby version
rehash Rehash rbenv shims (run this after installing executables)
version Show the current Ruby version and its origin
versions List all Ruby versions available to rbenv
which Display the full path to an executable
whence List all Ruby versions that contain the given executable
See `rbenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/sstephenson/rbenv#readme
What am I missing?
Ruby Solutions
Solution 1 - Ruby
The install
command is not embedded into rbenv, it comes from the ruby-build plugin. You can install it using the command:
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
On Mac OS X you can install it through homebrew:
brew install ruby-build
On Debian (version >= 7) and Ubuntu (version >= 12.10) both rbenv and ruby-build can be installed using apt-get
(or aptitude
):
sudo apt-get update
sudo apt-get install rbenv ruby-build
On FreeBSD ruby-build is available in the Ports Collection, it can be install both as a binary package or build from the port:
# Using pkgng rbenv will be installed
pkg install ruby-build
# Building ruby-build form Ports will install rbenv only if the RBENV option is set
cd /usr/ports/devel/ruby-build
make install
Solution 2 - Ruby
I found that when using rbenv from a global directory, it's necessary to export the RBENV_ROOT
variable, otherwise it won't load the plugins.
export RBENV_ROOT="/usr/local/rbenv"
if [ -d "${RBENV_ROOT}" ]; then
export PATH="${RBENV_ROOT}/bin:${PATH}"
fi
Solution 3 - Ruby
As everyone mentioned problem is missing ruby-build
. For older versions of OS ruby-build
may not be available as an apt
package. In that case install using original instructions, which should've omitted the word Optional
in this:
> 5. (Optional) Install ruby-build, which provides the rbenv install > command that simplifies the process of installing new Ruby versions.
git clone [email protected]:rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
# OR use http
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
Solution 4 - Ruby
Simply install ruby-build in ubuntu:
sudo apt-get install ruby-build
And add
eval "$(rbenv init -)"
To your ~/.bashrc
Solution 5 - Ruby
I had installed the ruby-build plugin before and installed ruby 1.9.3-p327 using
$ rbenv install 1.9.3-p327
A few days later I tried to install ruby 2.0.0-p247 using
$ rbenv install 2.0.0-p247
but I received the error message
rbenv: no such command 'install'
All I had to do was to run
$ exec $SHELL -l
and that fixed the problem.
Solution 6 - Ruby
Anyone finding their way here with this issue on OSX and already having installed ruby-build via homebrew (like me), you may solve this by just upgrading ruby-build:
brew update
brew upgrade ruby-build
This fixed the problem for me.
Solution 7 - Ruby
It looks like ruby-build is not present. Run this command :
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
Solution 8 - Ruby
Answered on 2021
If you're getting that error, it's very likely you have accidentally skipped one of the installation instructions:
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
Replace .bashrc
with whatever shell you're using, for example .zshrc
, or just manually access your shell config file and paste this line:
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
I strong advise against re-installing/installing Ruby via brew
or apt-get
just to get around this issue. The whole point of using rbenv
is to make your life easier in future when there is ruby version upgrade, or when you're working on different rails projects that require different version of ruby.
Solution 9 - Ruby
This issue also happens in Linux when doing a stand-alone installation of ruby-build, if the ruby-build
executable is not found in the path. If installing under /usr/local
, try for example:
PATH=/usr/local/bin:$PATH /usr/local/bin/rbenv install ...
Solution 10 - Ruby
I came to this solution, but looking for a macOS solution that uses MacPorts.
So, here the same command using MacPorts:
➜ ~ sudo port install ruby-build
Password:
---> Computing dependencies for ruby-build
---> Fetching archive for ruby-build
---> Attempting to fetch ruby-build-20210804_0.darwin_19.noarch.tbz2 from https://packages.macports.org/ruby-build
---> Attempting to fetch ruby-build-20210804_0.darwin_19.noarch.tbz2.rmd160 from https://packages.macports.org/ruby-build
---> Installing ruby-build @20210804_0
---> Activating ruby-build @20210804_0
---> Cleaning ruby-build
---> Scanning binaries for linking errors
---> No broken files found.
---> No broken ports found.
➜ ~ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
Checking for `rbenv' in PATH: /opt/local/bin/rbenv
Checking for rbenv shims in PATH: OK
Checking `rbenv install' support: /opt/local/bin/rbenv-install (ruby-build 20210804)
Counting installed Ruby versions: none
There aren't any Ruby versions installed under `/Users/user/.rbenv/versions'.
You can install Ruby versions like so: rbenv install 3.0.2
Checking RubyGems settings: OK
Auditing installed plugins: OK
➜ ~ rbenv install 3.0.2
Downloading openssl-1.1.1k.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5
Installing openssl-1.1.1k...