This guide will help you to configure your development environment for real world Rails development. These install instructions are for Ruby on Rails for Mac OS X Yosemite but can be adapted to other operation systems / platforms with minor os / platform specification adjustments. Feel free to leave a comment in case if you're stuck with an issue during the installation.
Before you start the installation, you'll need to ensure that Command Line Tools are installed on your Mac. The Xcode Command Line Tools provide a C language compiler needed to install Ruby. For many Rails projects, you will need the C language compiler to install gems that use native extensions. If you don't have the Command Line Tools installed, you can do so using the following command:
While you develop more than one project, you'll install gems and consequently might get into a dependency mess. Also, different projects might be using different version of Ruby. So, we'll need an easy way to switch between Ruby Versions. Ruby Version Manager (RVM) comes to our rescue here. RVM manages Ruby versions and gems and int can be also used to install Ruby.
RVM requires Homebrew which is a package manager for Mac OS X. To avoid RVM installation issues, install Homebrew before RVM. You can install Homebrew using the following command:
To install PostgresSQL, execute the following command:
Command Line Tools
Before you start the installation, you'll need to ensure that Command Line Tools are installed on your Mac. The Xcode Command Line Tools provide a C language compiler needed to install Ruby. For many Rails projects, you will need the C language compiler to install gems that use native extensions. If you don't have the Command Line Tools installed, you can do so using the following command:
xcode-select --install
You can verify the installation using the following command:
xcode-select -p
You can verify the installation using the following command:
xcode-select -p
Ruby Version Manager
While you develop more than one project, you'll install gems and consequently might get into a dependency mess. Also, different projects might be using different version of Ruby. So, we'll need an easy way to switch between Ruby Versions. Ruby Version Manager (RVM) comes to our rescue here. RVM manages Ruby versions and gems and int can be also used to install Ruby.
Homebrew
RVM requires Homebrew which is a package manager for Mac OS X. To avoid RVM installation issues, install Homebrew before RVM. You can install Homebrew using the following command:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
After the above command completes, remember to execute the following commands:
brew doctor
brew update
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
Finally, install RVM using:
\curl -sSL https://get.rvm.io | bash -s stable
You can skip stable if you want to install the development version.
Reload your bash_profile, so it can initialise RVM using the following command:
~/.bash_rc
Run the following command to install the required packages:
rvm requirements
To install the latest stable version of Ruby, execute the following command:
\curl -sSL https://get.rvm.io | bash -s stable --ruby
To install the latest version of Rails, execute the following command:
\curl -sSL https://get.rvm.io | bash -s stable --rails
You can install the database of your choice using Homebrew. To install MySQL, execute the following command:
brew install mysql
To install MongoDB using the following command:
brew install mongo
brew install mysql
To install MongoDB using the following command:
brew install mongo
To install PostgresSQL, execute the following command:
brew install postgresql
No comments:
Post a Comment