How to Install Gems from Gemfile in Ruby?
Ruby is a dynamic and object-oriented, general-purpose programming language. Ruby’s development was to make it act as a sensible buffer between human programmers and the underlying computing machinery. Basically, Ruby gems are open-source libraries that contain codes packaged with data. By using a gem, programmers can use the code within the gem in their own program.
Steps to Install Gems from Gemfile in Ruby
If you do not have Ruby on your computer you can refer to this article install Ruby. After installing the ruby programming language now we install the ruby gems from gemfile. Follow the steps to install Ruby Gems from Gemfile:
Step 1: Open the terminal and write gem install “gemname”, for example, gem install abc.
gem install “gemname”
Step 2: Bundler provides a consistent environment for Ruby projects by tracking and installing the needed gems and versions. Now we install Bundler using the command.
gem install bundler
Step 3: Now initializes the bundle using the init function, If you are getting an error in the terminal you can open any code editor in that folder in which the bundle installs and initializes the root directory.
Step 4: Bundler is a gem that manages dependencies. It creates an environment for Ruby projects. Now open the root directory and create Gemfile. Now open the Gemfile with the code editor and Specify the dependencies in a Gemfile.
Step 5: Now the install is required gems from the above sources by using the command in the code editor terminal.
Step 6: To verify gems installed, write the command in the terminal that gives the full list of gems installed in your computer.
Please Login to comment...