Installing Ruby on Rails Using ASDF

Why ASDF is Better Than RBENV for Rails Boostrap App? RailsSeries#Episode 00

J3
Jungletronics
9 min readMay 15, 2023

--

Based on: Pompermaier’s lessons:

Motivation:

Why ASDF is better than rbenv for project rails manager?

[ChatGPT]

It's difficult to say whether ASDF is "better" than rbenv for managing
Ruby on Rails projects because it depends on your specific needs
and preferences.

Both tools are popular and widely used, and they have their own
advantages and disadvantages.

ASDF is a version manager that supports multiple languages,
including Ruby, Node.js, Elixir, and Python.
It aims to be lightweight and fast, and it provides a simple
way to install, manage, and switch between multiple versions
of a language. It also integrates with your shell and text editor,
making it easy to use in your development workflow.

One advantage of ASDF over rbenv is that it can manage
multiple languages, which can be useful if you work on projects
that use different languages.

Additionally, ASDF has a simpler and more unified interface,
which can make it easier to learn and use.

On the other hand, rbenv is a popular Ruby version manager that has
been around for longer than ASDF.
It has a large and active community,
and it provides a wide range of plugins and extensions
that can add functionality and customization.
It's also known for being reliable and stable,
and it has been used by many developers for years.

Ultimately, the choice between ASDF and rbenv
will depend on your specific needs and preferences.

If you value simplicity and need to manage multiple languages,
ASDF may be a better fit.

If you prefer a more established tool with a large community
and extensive plugin support, rbenv may be the better option.

😉️

Hi, We will use asdf instead of rbenv on my Ubuntu 23.04 (Lunar Lobster) machine.

0 — TASK AND LINKS:

Installing Ruby on Rails Using asdf
asdf-ruby

asdf

Removing RBENV (if present in your machine):

sudo apt-get remove rbenv 
sudo apt-get remove — auto-remove rbenv
sudo apt-get purge rbenv
sudo apt-get purge — auto-remove rbenv

1 — Open nano, Type:

sudo nano ~/.bashrc

And comments rbenv.

Add the following to the end of ~/.bashrc:

. "$HOME/.asdf/asdf.sh"
. "$HOME/.asdf/completions/asdf.bash"

Restart your shell so that PATH changes take effect. Opening a new terminal tab will usually do it.

Then (if applyed):

sudo apt autoremove -y
sudo apt-get autoclean
sudo apt-get — force-yes remove rbenv
sudo apt-get — allow remove rbenv
sudo dpkg -r rbenv
rbenv

2 — Installing all dependencies (fresh Ubuntu 23.04👌️):


sudo apt-get update
sudo apt install git
sudo apt install openssl -y
sudo apt-get install build-essential
sudo apt-get install libz-dev
sudo apt-get install libyaml-dev
apt-get install -y libssl-dev
sudo apt-get install -y libssl-dev

3 — Installing ASDF & latest ruby

Please, Go here and download the asdf last version…mine is v0.12.0.

https://asdf-vm.com/guide/getting-started.html#official-download


git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.12.0

asdf plugin list all
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
asdf install ruby latest
asdf list

ruby -version
No version is set for command ruby
Consider adding one of the following versions in your config file at
ruby 3.2.2

asdf local ruby 3.2.2

ruby --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]

ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]

4 — Installing nodejs & yarn: [optional — beware Turbo issues]

 asdf plugin add nodejs
asdf plugin add yarn
asdf install nodejs latest
asdf list
asdf install yarn latest
asdf list
asdf global yarn 1.22.19
asdf global nodejs 20.1.0
asdf global ruby 3.0.2
ruby -v
yarn -v
which ruby
which yarn

4 — Installing Rails 7

gem install rails
gem update --system 3.4.16



rails -v
Rails 7.0.6

5— Create a Bootstrap Rails Project on VSCode: [Optional: In these times we prefer to use cdn link — devise will not work by default]

mkdir -p projects/ruby
cd projects/ruby/
rails new blog --css bootstrap
cd blog/
code .
rails s

Inside the project folder:

gem install bundler
bundle install
bundle exec rails assets:precompile
bundle exec rails s -b 0.0.0.0

That’s all folks!

Hope that helps!

Bye!

Credits

MÁRCIO POMPERMAIER

More plugins:

POSTGRES:
asdf plugin-add postgres
asdf install postgres latest
asdf list

MORE: SOON:)

Notes:

j3@JAYTHREE:~$ gem install rails
Fetching zeitwerk-2.6.8.gem
Fetching thor-1.2.2.gem
Fetching method_source-1.0.0.gem
Fetching concurrent-ruby-1.2.2.gem
Fetching tzinfo-2.0.6.gem
Fetching i18n-1.14.1.gem
Fetching minitest-5.18.1.gem
Fetching activesupport-7.0.6.gem
Fetching nokogiri-1.15.3-x86_64-linux.gem
Fetching crass-1.0.6.gem
Fetching loofah-2.21.3.gem
Fetching rails-html-sanitizer-1.6.0.gem
Fetching rails-dom-testing-2.1.1.gem
Fetching rack-2.2.7.gem
Fetching rack-test-2.1.0.gem
Fetching erubi-1.12.0.gem
Fetching builder-3.2.4.gem
Fetching actionview-7.0.6.gem
Fetching actionpack-7.0.6.gem
Fetching railties-7.0.6.gem
Fetching mini_mime-1.1.2.gem
Fetching marcel-1.0.2.gem
Fetching activemodel-7.0.6.gem
Fetching activerecord-7.0.6.gem
Fetching globalid-1.1.0.gem
Fetching activejob-7.0.6.gem
Fetching activestorage-7.0.6.gem
Fetching actiontext-7.0.6.gem
Fetching mail-2.8.1.gem
Fetching actionmailer-7.0.6.gem
Fetching actionmailbox-7.0.6.gem
Fetching websocket-extensions-0.1.5.gem
Fetching rails-7.0.6.gem
Fetching websocket-driver-0.7.5.gem
Fetching nio4r-2.5.9.gem
Fetching actioncable-7.0.6.gem
Successfully installed zeitwerk-2.6.8
Successfully installed thor-1.2.2
Successfully installed method_source-1.0.0
Successfully installed concurrent-ruby-1.2.2
Successfully installed tzinfo-2.0.6
Successfully installed minitest-5.18.1
Successfully installed i18n-1.14.1
Successfully installed activesupport-7.0.6
Successfully installed nokogiri-1.15.3-x86_64-linux
Successfully installed crass-1.0.6
Successfully installed loofah-2.21.3
Successfully installed rails-html-sanitizer-1.6.0
Successfully installed rails-dom-testing-2.1.1
Successfully installed rack-2.2.7
Successfully installed rack-test-2.1.0
Successfully installed erubi-1.12.0
Successfully installed builder-3.2.4
Successfully installed actionview-7.0.6
Successfully installed actionpack-7.0.6
Successfully installed railties-7.0.6
Successfully installed mini_mime-1.1.2
Successfully installed marcel-1.0.2
Successfully installed activemodel-7.0.6
Successfully installed activerecord-7.0.6
Successfully installed globalid-1.1.0
Successfully installed activejob-7.0.6
Successfully installed activestorage-7.0.6
Successfully installed actiontext-7.0.6
Successfully installed mail-2.8.1
Successfully installed actionmailer-7.0.6
Successfully installed actionmailbox-7.0.6
Successfully installed websocket-extensions-0.1.5
Building native extensions. This could take a while...
Successfully installed websocket-driver-0.7.5
Building native extensions. This could take a while...
Successfully installed nio4r-2.5.9
Successfully installed actioncable-7.0.6
Successfully installed rails-7.0.6
Parsing documentation for zeitwerk-2.6.8
Installing ri documentation for zeitwerk-2.6.8
Parsing documentation for thor-1.2.2
Installing ri documentation for thor-1.2.2
Parsing documentation for method_source-1.0.0
Installing ri documentation for method_source-1.0.0
Parsing documentation for concurrent-ruby-1.2.2
Installing ri documentation for concurrent-ruby-1.2.2
Parsing documentation for tzinfo-2.0.6
Installing ri documentation for tzinfo-2.0.6
Parsing documentation for minitest-5.18.1
Couldn't find file to include 'README.rdoc' from lib/minitest.rb
Installing ri documentation for minitest-5.18.1
Parsing documentation for i18n-1.14.1
Installing ri documentation for i18n-1.14.1
Parsing documentation for activesupport-7.0.6
Installing ri documentation for activesupport-7.0.6
Parsing documentation for nokogiri-1.15.3-x86_64-linux
Installing ri documentation for nokogiri-1.15.3-x86_64-linux
Parsing documentation for crass-1.0.6
Installing ri documentation for crass-1.0.6
Parsing documentation for loofah-2.21.3
Installing ri documentation for loofah-2.21.3
Parsing documentation for rails-html-sanitizer-1.6.0
Installing ri documentation for rails-html-sanitizer-1.6.0
Parsing documentation for rails-dom-testing-2.1.1
Installing ri documentation for rails-dom-testing-2.1.1
Parsing documentation for rack-2.2.7
Installing ri documentation for rack-2.2.7
Parsing documentation for rack-test-2.1.0
Installing ri documentation for rack-test-2.1.0
Parsing documentation for erubi-1.12.0
Installing ri documentation for erubi-1.12.0
Parsing documentation for builder-3.2.4
Installing ri documentation for builder-3.2.4
Parsing documentation for actionview-7.0.6
Installing ri documentation for actionview-7.0.6
Parsing documentation for actionpack-7.0.6
Installing ri documentation for actionpack-7.0.6
Parsing documentation for railties-7.0.6
Installing ri documentation for railties-7.0.6
Parsing documentation for mini_mime-1.1.2
Installing ri documentation for mini_mime-1.1.2
Parsing documentation for marcel-1.0.2
Installing ri documentation for marcel-1.0.2
Parsing documentation for activemodel-7.0.6
Installing ri documentation for activemodel-7.0.6
Parsing documentation for activerecord-7.0.6
Installing ri documentation for activerecord-7.0.6
Parsing documentation for globalid-1.1.0
Installing ri documentation for globalid-1.1.0
Parsing documentation for activejob-7.0.6
Installing ri documentation for activejob-7.0.6
Parsing documentation for activestorage-7.0.6
Installing ri documentation for activestorage-7.0.6
Parsing documentation for actiontext-7.0.6
Installing ri documentation for actiontext-7.0.6
Parsing documentation for mail-2.8.1
Installing ri documentation for mail-2.8.1
Parsing documentation for actionmailer-7.0.6
Installing ri documentation for actionmailer-7.0.6
Parsing documentation for actionmailbox-7.0.6
Installing ri documentation for actionmailbox-7.0.6
Parsing documentation for websocket-extensions-0.1.5
Installing ri documentation for websocket-extensions-0.1.5
Parsing documentation for websocket-driver-0.7.5
Installing ri documentation for websocket-driver-0.7.5
Parsing documentation for nio4r-2.5.9
Installing ri documentation for nio4r-2.5.9
Parsing documentation for actioncable-7.0.6
Installing ri documentation for actioncable-7.0.6
Parsing documentation for rails-7.0.6
Installing ri documentation for rails-7.0.6
Done installing documentation for zeitwerk, thor, method_source, concurrent-ruby, tzinfo, minitest, i18n, activesupport, nokogiri, crass, loofah, rails-html-sanitizer, rails-dom-testing, rack, rack-test, erubi, builder, actionview, actionpack, railties, mini_mime, marcel, activemodel, activerecord, globalid, activejob, activestorage, actiontext, mail, actionmailer, actionmailbox, websocket-extensions, websocket-driver, nio4r, actioncable, rails after 24 seconds
36 gems installed

A new release of RubyGems is available: 3.4.10 → 3.4.16!
Run `gem update --system 3.4.16` to update your installation.

j3@JAYTHREE:~$ gem update --system 3.4.16
Updating rubygems-update
Fetching rubygems-update-3.4.16.gem
Successfully installed rubygems-update-3.4.16
Parsing documentation for rubygems-update-3.4.16
Installing ri documentation for rubygems-update-3.4.16
Done installing documentation for rubygems-update after 36 seconds
Parsing documentation for rubygems-update-3.4.16
Done installing documentation for rubygems-update after 0 seconds
Installing RubyGems 3.4.16
Successfully built RubyGem
Name: bundler
Version: 2.4.16
File: bundler-2.4.16.gem
Bundler 2.4.16 installed
RubyGems 3.4.16 installed
Regenerating binstubs
Regenerating plugins
Parsing documentation for rubygems-3.4.16
Installing ri documentation for rubygems-3.4.16

# 3.4.16 / 2023-07-10

## Enhancements:

* Installs bundler 2.4.16 as a default gem.

# 3.4.15 / 2023-06-29

## Enhancements:

* Installs bundler 2.4.15 as a default gem.

## Bug fixes:

* Autoload shellwords when it's needed. Pull request
[#6734](https://github.com/rubygems/rubygems/pull/6734) by ioquatix

## Documentation:

* Update command to test local gem command changes. Pull request
[#6761](https://github.com/rubygems/rubygems/pull/6761) by jenshenny

# 3.4.14 / 2023-06-12

## Enhancements:

* Load plugin immediately. Pull request
[#6673](https://github.com/rubygems/rubygems/pull/6673) by kou
* Installs bundler 2.4.14 as a default gem.

## Documentation:

* Clarify what the `rubygems-update` gem is for, and link to source code
and guides. Pull request
[#6710](https://github.com/rubygems/rubygems/pull/6710) by davetron5000

# 3.4.13 / 2023-05-09

## Enhancements:

* Installs bundler 2.4.13 as a default gem.

# 3.4.12 / 2023-04-11

## Enhancements:

* [Experimental] Add WebAuthn Support to the CLI. Pull request
[#6560](https://github.com/rubygems/rubygems/pull/6560) by jenshenny
* Installs bundler 2.4.12 as a default gem.

# 3.4.11 / 2023-04-10

## Enhancements:

* Installs bundler 2.4.11 as a default gem.


------------------------------------------------------------------------------

RubyGems installed the following executables:
/home/j3/.asdf/installs/ruby/3.2.2/bin/gem
/home/j3/.asdf/installs/ruby/3.2.2/bin/bundle
/home/j3/.asdf/installs/ruby/3.2.2/bin/bundler

Ruby Interactive (ri) documentation was installed. ri is kind of like man
pages for Ruby libraries. You may access it like this:
ri Classname
ri Classname.class_method
ri Classname#instance_method
If you do not wish to install this documentation in the future, use the
--no-document flag, or set it as the default in your ~/.gemrc file. See
'gem help env' for details.

RubyGems system software updated

Edited — jul/2023 — running a fresh Ubuntu 23.04 👌️

Related Posts:

00# Episode — RailsSeries — Installing Ruby on Rails Using ASDF — Why ASDF is Better Than RBENV for Rails Bootstrap App? (this one)

01# Episode — RailsSeries — How To Send Email In Rails 7? — User Registration and Onboarding.

02# Episode — RailsSeries — 14 Ruby Extensions 4 Vs Code — Based On This Deanin’s video.

03# Episode — RailsSeries — A Rails Blog In VS Code — Quick Start — How To Create A Blog in VS Code — Part I

04# Episode — RailsSeries — A Rails Blog In VS Code — Styling — How To Create A Blog in VS Code — Part II

05# Episode — RailsSeries — A Rails Blog In VS Code — Create Posts — How To Create A Blog in VS Code — Part III

06# Episode — RailsSeries — A Rails Blog In VS Code — Posts Tips&Tricks — How To Create A Blog in VS Code — Part IV

07# Episode — RailsSeries — A Rails Blog In VS Code — Devise — How To Create A Blog in VS Code — Part V

08# Episode — RailsSeries — A Rails Blog In VS Code — Add Comments to Post — How To Create A Blog in VS Code — Part VI

09# Episode — RailsSeries — Rails Blog In VS Code — Using Stimulus — How To Create A Blog in VS CodePart VII

10# Episode — RailsSeries — Rails Blog In VS Code — Noticed V1 — Notifications for your Ruby on Rails app — Part VIII

11# Episode — RailsSeries — Rails Blog In VS Code — Noticed V2 — Notifications for your Ruby on Rails app — Part IX

--

--

J3
Jungletronics

Hi, Guys o/ I am J3! I am just a hobby-dev, playing around with Python, Django, Ruby, Rails, Lego, Arduino, Raspy, PIC, AI… Welcome! Join us!