Unknown model· unknown
from ShareGPT 90K (shared ChatGPT conversations)
How to install Ruby in Ubuntu
- User
How to install Ruby in Ubuntu
- Assistant
To install Ruby on Ubuntu, you can use the package manager
apt. Here are the steps:- Open a terminal and update the package manager index:
codesudo apt update- Install Ruby and the package manager
gem, which is used to install Ruby packages:
codesudo apt install ruby-full- To verify the installation, check the Ruby version:
coderuby -vThis should print the Ruby version number.
You can also install specific versions of Ruby using a tool called
rbenv, which allows you to manage multiple versions of Ruby on the same machine. To installrbenv, follow these steps:- Install
rbenvand its dependencies:
codesudo apt install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev- Clone the
rbenvrepository from GitHub:
codegit clone https://github.com/rbenv/rbenv.git ~/.rbenv- Add
rbenvto your shell:
codeecho 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc- Reload your shell:
codeexec $SHELL- Install the
ruby-buildplugin, which allows you to install specific versions of Ruby:
codegit clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build- Restart your terminal and install the version of Ruby you want to use:
coderbenv install 2.7.2- Set the installed version of Ruby as the global default:
coderbenv global 2.7.2