How to Install Ruby on Rails on MacOS?
Last Updated :
17 Sep, 2024
Ruby on Rails, also known as rails, is a server-side web application development framework written in the Ruby programming language. David Heinemeier Hansson developed it under the MIT License. It supports MVC (model-view-controller) architecture that provides a default structure for databases, web pages, and web services. It also uses web standards like JSON or XML for transferring data and HTML, CSS, and JavaScript for the user interface.
Pros for using Ruby on Rails
- Great for rapid application development (RAD)
- Battery-included Framework
- Object-Oriented Nature of Ruby and has a vast collection of open source code available within the Rails community
- Has good testing frameworks
Cons for using Ruby on Rails
- Performance and Scalability
- Not all websites hosts can support Rails
- Shortage of flexibility
for more: Ruby on Rails Introduction
Download and Installation of Ruby on Rails
macOS usually comes with pre-installed Ruby in its /usr/bin/ruby section.
However, using this version of ruby is not recommended as it is old, can't be updated, and installing gems doesn't work out of the box with the system ruby. This can be done using third-party tools such as rbenv and RVM. This article follows installation through RVM (Ruby Version Manager).
- Installing RVM (Ruby Version Manager)
\curl -sSL https://get.rvm.io | bash -s stable
Installing RVM rvm use ruby --install--default
Installing a newer version of Ruby and setting it as default
Ruby gem installations sometimes can be very slow because of the on-the-fly document generation post-process. Thus, it is better to download it without documentation.
gem install rails --no-document
This may take some time as there are many libraries to download. After the installation is complete, restart the terminal.
Location and Version of Rails- Running Ruby on Rails Application
To check if we can run the Ruby on Rails application, we can create a trial app and try running this application.
Choose any preferable location on your Mac and carry out the following commands on your terminal. It may take some time for rails to create a new app.
mkdir trial-app
cd trial-app/
rails new trialapp
cd trialapp
rails server
Running the rails application through the Command LineOpen the listening port by copying and pasting the URL in the browser or hold the command and click on the link.
Opening the link in the browserTo stop the application, press Control + C in the terminal.
Similar Reads
How to Install RubyGems on MacOS? Ruby is a high-level and open-source programming language. It is very useful in many aspects. Like other programming languages, Ruby is nowadays a highly useful programming language. In Ruby, there is a package manager available which is known as Gems. It is easily distributed and provides libraries
2 min read
How to Install Scala on MacOS? In this article, we are going to show you how you can download and install Scala on your Mac operating system. First of all, you need to download the Java JDK which you can download here Installing Scala on MacOS: Follow the below steps to install Scala on MacOS: Step 1: After installing JDK, run th
2 min read
How to Install PyBrain on MacOS? PyBrain is an open-source and free-to-use Python-based Machine Learning Library. Its main purpose is to provide machine learning tasks with flexible, easy-to-use, still a very powerful algorithms. It also provides a wide range of predefined environments which is used to test and compare different ty
2 min read
How to Install ReactJS on MacOS Are you looking to set up ReactJS on your Mac? Whether youâre using a MacBook Air, MacBook Pro, iMac, or any macOS version like Monterey, Ventura, Big Sur, or macOS 15 Sequoia, this step-by-step guide is here to help. How To Install React on macOSTo install ReactJS on macOS, you first need to have N
5 min read
How to install Solidity on macOS? Solidity is a programming language used for writing smart contracts for many platforms of blockchain, the most common of which is ethereum. It is an object-based programming language that runs on EVM (Ethereum Virtual Machine) which executes the smart contracts. Below are the steps to install solidi
2 min read