Install Ruby on Rails on Manjaro Linux

I based this installation from the official arch documentation wiki including a couple specific steps.

Rails requires nodejs package so we need to install nodejs

sudo pacman -S nodejs

Now we need to install ruby

sudo pacman -S ruby

Ruby includes RubyGems, RubyGems will install the gems to a directory inside your home directory, something like ~/.gem/ruby/2.1.0 The commands provided by the gems you installed will end up in ~/.gem/ruby/2.1.0/bin. For the programs installed there to be available for you, you need to add ~/.gem/ruby/2.1.0/bin to your PATH environment variable.

So wen can add that directory to our PATH, so fist we need to open ~/.bashrc file

nano ~/.bashrc

and add the this code

if which ruby >/dev/null && which gem >/dev/null; then
    PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH"
fi

save it, now we need to restart our shell for the changes to take effect. You can do this by opening a new terminal window or by running exec $SHELL in the window you already have open.

exec $SHELL

now we can proceed with installing rails, but before that, we need to run the following commands as root

gem install rails --no-document

and the we can update the gems

gem update

we can check all these tools are successfully installed

ruby -v
gem -v
rails -v
rake --version

now wen can start to create our first application:

rails new testapp
cd testapp
bin/rails server

alt tag

References: