Installing ruby with rbenv

Asked

Viewed 494 times

4

I have a question, I installed the ruby in Ubuntu, but it was installed without the rbenv, has any problem installing it now, or it will be necessary to remove it first?

3 answers

2

Robson, the ideal is for you to remove first to protect yourself from any conflict issues between Ruby versions. Leave everything to rbev.

sudo apt-get purge ruby rubygems

2

The rbenv is a very comprehensive but very useful tool when it is necessary to use several versions in different projects, so if you do not need it, the default installation should suit you well.

0

Installed via apt install ? If yes! No need to uninstall what was installed via apt install .

Now if the installation via the "RVM" is recommended to uninstall the entire "RMV" by executing the simple command on the terminal:

rvm implode

or

rm -rf ~/.rvm

It is to install the rbenv that not my opinion is much better either the RVM: Type these simple commands into the terminal.

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv

Then you should add the rbenv on $PATH just execute the command on the terminal.

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc

and the command for initialization of the rbenv script:

echo 'eval "$(rbenv init -)"' >> ~/.bashrc

p.s: Repair the shell configuration file you are using on your machine, be it the bash is the above heading if not and switch to the file in question at the end of the ". bashrc" command to ". zshrc" for example.

After installation and only restart the terminal and run the command:

rbenv install -l

And choose the version you want to install. Example:

rbenv install 2.3

To define the version globally on the machine:

rbenv global 2.3

Ready to execute the command ruby -v is to check the installation.

I hope I’ve helped.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.