Rails For Mac

by Daniel Kehoe

  1. Mac Rail Llc
  2. Macrail Products
  3. Rails Form Action
  4. Rails Format Number
  5. Rails For Mauser M18

Thrillville™: Off the Rails lives up to its name with 20 death-defying rides so outrageous, they inspire the same word from every park visitor who sees them: “WHOA!” Players build these incredible “WHOA Coasters” to leap from one track to another, launch through the air like cannonballs, blast through a burning ring of fire and more. Rails is a program that lets you play the 18xx series of board games. Rails supports hotseat mode and can act as a moderator to speed up face-to-face games. We plan to support an AI, play-by-email and network play. As Rails is made using Java, it runs on Windows, Mac and Linux.

  1. The Mil-Spec 1913 Picatinny rails are used to mount accessories such as flashlights, scopes, red dot sights, lasers, and more to your AR15 weapon system. Used by armed professionals, military, law enforcement and shooting enthusiasts, AR15 tactical rails are the standard for modern day 'black gun' shooters.
  2. Upgrade Your System to OS X Mavericks. Installing Ruby on Rails is simple, but unless you.
  3. Mac's Exclusive Toyota Tundra Bed Rail Kit Choose your options Item# 521012: Spreader Bar For use with VersaTie track. Spreader bar includes (2) Thread Stud Fittings and (2) 4 Prong Knobs. (Mac's Wedge Sold Separately) Choose your options Item# 635000: Mac's Tundra Truck Kit Front Piece Mac's Exclusive Toyota Tundra Bed Kit Front Piece Price.

See the author's blog at danielkehoe.com

Last updated 16 May 2020

This is an article from the RailsApps project. The RailsApps project provides Rails Example Applications that developers use as starter apps.

Install Ruby on Rails 6.0 on macOS 10.15 Catalina. Up-to-date and detailed instructions, plus troubleshooting, for the Rails newest release. How to set up and install Rails 6.0, the newest version of Rails, on macOS 10.15 Catalina.

The most complete and up-to-date installation guide for Ruby on Rails on macOS and a favorite of Rails developers. It explains how to set up a development environment for Rails, the same used by any professional Rails developer.

If You Are New to Rails

To use Rails on macOS, you'll need Ruby (an interpreter for the Ruby programming language) plus gems (software libraries) containing the Rails web application development framework. If you're new to Rails, see What is Ruby on Rails? or get the free book Learn Ruby on Rails.

Ruby Version Managers

You may hear about one-click installation programs such as RailsInstaller, Cinderella, and BitNami RubyStack. These installation programs are often outdated. Most developers install from scratch.

MacOS comes with a 'system Ruby' pre-installed. MacOS Catalina includes Ruby 2.6.3 which is not the newest version. Do not use the system Ruby (see an article for why). You should install a Ruby version manager and update to the newest Ruby version. You'll find instructions below.

Use Chruby to switch between Ruby versions. Some developers prefer RVM or rbenv but I now recommend Chruby.

A Ruby version manager makes it easy to switch between Ruby versions. I recommend Chruby. RVM was popular in the past but its additional features (its gemsets) are no longer necessary and it adds unnecessary complexity. Sam Stephenson's rbenv is also popular, but requires extra steps (the rehash command) and modifies gems when you install them.

Even if you are a student only building new Rails applications, you should be prepared to manage multiple versions of Ruby. In the future, you will need to install newer Ruby versions as they are released. And if you maintain older Rails applications, you will need a Ruby version manager.

You'll need to prepare your computer before installing Ruby on Rails.

Prepare Your Computer

A Hosted Development Alternative

You can use Ruby on Rails without actually installing it on your computer. Hosted development, using a service such as AWS Cloud9, means you get a computer 'in the cloud' that you use from your web browser. Any computer can access the hosted development environment, though you'll need a broadband connection. Cloud9 is free for small projects.

Using a hosted environment means you are no longer dependent on the physical presence of a computer that stores all your files. If your computer crashes or is stolen, you can continue to use your hosted environment from any other computer. Likewise, if you frequently work on more than one computer, a hosted environment eliminates the difficulty of maintaining duplicate development environments. However, most developers set up a local developmemt environment on their own computer.

These instructions are for macOS Catalina 10.15.

If You Updated to macOS Catalina

If you updated to Catalina from an earlier version of macOS (sometimes called an 'over the top' installation), and you previously installed a Rails development environment, your earlier installation remains intact. You will need to install the new version of Xcode Command Line Tools (full instructions below). Though Rails is still intact after an update, read through this article and take this opportunity to update your development environment.

Upgrade macOS to Catalina

MacOS Catalina was released on October 7, 2019. Make sure you have the latest version of macOS. Under the Apple menu, check 'About This Mac.' It should show 'Version 10.15.0' or newer. If you've owned your Mac for several years and haven't updated macOS, be prepared to spend several hours updating the operating system.

If you need to upgrade, see Apple's instructions Upgrade to macOS Catalina. You can install macOS 10.15 (Catalina) from the Mac App Store for free. Allow plenty of time for the download and installation (it may take several hours).

If you've already done development on earlier Mac versions, be aware of these changes in Catalina:

  • Catalina uses Zsh as a default shell instead of Bash. You'll set configurations (such as PATH and aliases) in the .zshrc file.
  • Apple has removed the /usr/include folder making it difficult to compile some older system tools.

Terminal Application (for Beginners)

To learn more about Unix shell commands, read The Command Line Crash Course or Learn Enough Command Line to Be Dangerous.

You'll need to use the Terminal application to install Ruby and develop Rails applications. The Terminal application or console gives us access to the Unix command line, or shell. We call the command line the shell because it is the outer layer of the operating system's internal mechanisms (which we call the kernel). Search for the macOS Terminal application by pressing the Command-Spacebar combination (which Apple calls 'Spotlight Search') and searching for 'Terminal.' Or look in the Applications/Utilities/ folder for the Terminal application.

You'll also need a text editor (typically VS Code or Atom) to configure your Mac (and for writing code).

Launch the Terminal application. Then try out the terminal application by entering a shell command:

$ whoami

Don't type the $ character. The $ character is a cue that you should enter a shell command. This is a longtime convention that indicates you should enter a command in the terminal application. The Unix shell command whoami returns your username.

Just a reminder to absolute beginners: Press 'Enter' after you type the command.

Is Xcode Already Installed?

You need to install Apple's Xcode Command Line Tools to get the Unix tools needed to install Ruby and develop with Rails. Xcode is Apple's software library for macOS developers. You don't need all of Xcode for Rails development. You just need the Xcode Command Line Tools. Only install the full Xcode package if you are doing development of applications for the Apple operating systems.

Check if you have previously installed the full Xcode package:

$ xcode-select -p

Scenario 1

If you see:

xcode-select: error: unable to get active developer directory..

The Xcode package is not installed. Jump to the next section and install only the Xcode Command Line Tools.

Scenario 2

If you see:

/Applications/Xcode.app/Contents/Developer

The full Xcode package is already installed. Perhaps you installed it previously. If Xcode is installed, you will need to update Xcode to the newest version (Xcode 11 or newer). Go to the App Store application and check 'Updates.' After updating Xcode, be sure to launch the Xcode application and accept the Apple license terms.

Scenario 3

If you see:

/Library/Developer/CommandLineTools

The Xcode Command Line Tools may be installed or an older version is installed. Here's how to test:

$ /usr/sbin/pkgutil --packages grep CL

You should see:

com.apple.pkg.CLTools_Executables

Also try:

/usr/sbin/pkgutil --pkg-info com.apple.pkg.CLTools_Executables

You should see:

package-id: com.apple.pkg.CLTools_Executables

If you get a response from the test, you're done. The Xcode Command Line Tools are installed and you can skip ahead to install Homebrew.

If you get no response from the test, you have an older version of Xcode Command Line Tools and you must remove it.

Remove the old version:

$ sudo rm -rf /Library/Developer/CommandLineTools

You are using sudo for admin access so you must enter the password you use to log in to your computer (you will not see the password after entering it). After removing the old version, jump to the next section and install the Xcode Command Line Tools.

Scenario 4

If you see a file location that contains spaces in the path:

/Applications/Apple Dev Tools/Xcode.app/Contents/Developer

you will have problems installing Ruby. You should delete and reinstall Xcode.

Install Xcode Command Line Tools

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 (such as Nokogiri).

Here's how to install Apple's Xcode Command Line Tools.

MacOS Catalina will alert you when you enter a command in the terminal that requires Xcode Command Line Tools. For example, you can enter gcc, git, or make.

Try it. Enter:

$ gcc

If Xcode Command Line Tools are not installed, you'll see an alert box:

Alternatively, you can use a command to install Xcode Command Line Tools. It will produce a similar alert box. Note the double hyphen:

$ xcode-select --install

Click 'Install' to download and install Xcode Command Line Tools. If you have a slow Internet connection, it may take many minutes.

If the download takes a very long time (over an hour) or fails, you can try an alternative. Go to https://developer.apple.com/downloads/more and enter your Apple ID and password. You'll see a list of software packages you can download. Look for the latest version of Command Line Tools and click to download the .dmg file. Downloading the .dmg file is much faster than waiting for the command-line-based download. Install the .dmg file by clicking on the package icon. You'll need about 1.46GB of storage on your computer.

Verify that you've successfully installed Xcode Command Line Tools.

$ xcode-select -p

You should see:

/Library/Developer/CommandLineTools

The Xcode Command Line Tools must be installed before you go to the next steps. Just to be certain, verify that the Command Line Tools executables are available:

$ /usr/sbin/pkgutil --packages grep CL

You should see:

com.apple.pkg.CLTools_Executables

Also try:

/usr/sbin/pkgutil --pkg-info com.apple.pkg.CLTools_Executables

You should see:

package-id: com.apple.pkg.CLTools_Executables

If the Command Line Tools executables are available, you'll have no problem compiling Nokogiri or any other gems that require native extensions.

Install Homebrew

Developers use Homebrew to install various Unix software packages, including chruby and ruby-install.

If you did not use a password to log in to your Mac (that is, if your password is blank), you cannot install Homebrew.

$ brew

Check if Homebrew is installed.

If Homebrew is not installed, install it.

$ /bin/bash -c '$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)'

The Homebrew installation script will ask you to enter your Mac password.

Password:

The Homebrew installation script may display a warning:

WARNING: Improper use of the sudo command could lead to data loss..

To proceed, enter your password..

Ignore the scary warning and enter your Mac password. You won't see the characters as you type. Press enter when you are done.

If you've installed Homebrew, you can check that Homebrew is installed properly.

$ brew doctor

Next we'll configure Git, an essential tool for any developer.

Configure Git

Before installing Ruby on Rails, you should configure Git. Git is automatically installed as part of the Xcode Command Line Tools.

Git provides a source control repository. Developers use Git to roll back code changes when needed, to collaborate with others, and deploy applications for hosting with a service such as Heroku. As a Rails developer, you'll use Git with a GitHub account for remote backup and collaboration. See the article Rails with Git and GitHub for more background.

Before you configure Git, it is a good idea to create an account on GitHub. It is important to use the same email address for Git and for GitHub. After you create an account on GitHub, follow their instructions to set up an SSH key so you don't have to enter a username and password every time you connect to GitHub from the Terminal.

Check that Git is installed:

$ git version

You should see git version 2.21.1 (or newer).

If the Git version installed with Xcode Command Line Tools is old, you can use Homebrew to install the latest version of Git:

Guitar tuner for mac os high sierra

Mac Rail Llc

$ brew install git

You can use Homebrew to upgrade to the newest version of Git:

$ brew upgrade git

Configure Git if you haven't used it before. First, list the current settings with the git config -l --global command. Then set user.name and user.email if necessary. Don't just copy and paste the code you see here. Edit it to add your name and the email address you've used for GitHub.

Now you'll be ready to use Git when you need it.

Install Ruby-install and Chruby

Use Homebrew to install the ruby-install utility and the chruby Ruby version manager.

$ brew install ruby-install chruby

You'll see beer mug emojis (part of the Emoji 1.0 standard released in 2015).

Configure Chruby

You must update your Unix .zshrc file so that the chruby program can be found.

The .zshrc file is in your user home folder. It is hidden in the file browser. You can enter Command + Shift + . to show hidden files. If you want to hide those files again, you can enter the same keystrokes.

You can force the Mac to always display hidden files by entering the following command in the Terminal application:

$ defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder

Hidden files will appear in gray in the Finder window.

Use your text editor (typically VS Codeor Atom) to open the .zshrc file. Check the instructions for your text editor to learn how to open files from the terminal. In VS Code, open the Command Palette (⇧⌘P) and type 'shell command' to locate and click 'Shell Command: Install 'code' command in PATH command.'

To open the .zshrc file with VS Code:

$ code ~/.zshrc

In Unix, the squiggle (tilde) character is a shortcut to your user home folder.

Add two lines anywhere in your .zshrc file. Your .zshrc file may not exist (or may be empty) if you have not used it before. Saving the file will create it.

source /usr/local/share/chruby/chruby.sh

source /usr/local/share/chruby/auto.sh

The first line makes the chruby program available in the shell. The second line will automatically switch the current version of Ruby when you change directories if a hidden file indicates a specific Ruby version.

You must close and reopen the Terminal window for the changes to the .zshrc file to be recognized.

Check that each program was installed successfully.

$ ruby-install -V

$ chruby -h

Now you can install the newest Ruby version.

Install Ruby

After installing the ruby-install utility, install the newest version of Ruby.

The Chruby version manager will use your shell to intercept any calls to Ruby. There's no need to remove the system Ruby. The system Ruby will remain on your system and your preferred version will take precedence.

You can check for the current recommended version of Ruby. Tell the ruby-install utility to check for the newest Ruby version.

$ ruby-install --latest

Then install the newest Ruby version.

$ ruby-install --latest ruby

Add a line to the .zshrc file to set the new Ruby version as a default.

chruby ruby-2.7.0

You'll need to close and re-open the terminal window.

Then verify that the newest version of Ruby is installed:

$ ruby -v

Now you can update the development environment. It is likely some gems have been updated since the newest version of Ruby was released. It's best if everything is up to date before you start a new project.

Check the Gem Manager

RubyGems is the package manager in Ruby. We use it to install software packages that add functionality to Ruby.

Check the installed gem manager version.

$ gem -v

You can check if a newer RubyGems version is available. Use gem update --system to upgrade the Ruby gem manager:

$ gem update --system

Faster Gem Installation

By default, when you install gems, documentation files will be installed. Developers seldom use gem documentation files (they'll browse the web instead). Installing gem documentation files takes time, so many developers like to toggle the default so no documentation is installed.

Here's how to speed up gem installation by disabling the documentation step:

$ echo 'gem: --no-document' >> ~/.gemrc

This adds the line gem: --no-document to the hidden .gemrc file in your home directory.

Install Nokogiri

Nokogiri is a gem that is a dependency for many other gems. Nokogiri is a gem that requires compilation for your specific operating system. As such, if your system environment doesn't match Nokogiri's requirements, compilation of Nokogiri will fail. If your system is configured properly, you'll be able to compile Nokogiri. However, compilation takes time. Every time you install the Nokogiri gem, you'll wait (as long as five minutes).

To save time, install the Nokogiri gem:

$ gem install nokogiri

During installation, Nokogiri will display two lengthy messages in the console. It will also pause without displaying any progress for as long as five minutes. Don't assume installation has failed unless you see an error message or you've waited more than ten minutes.

If Nokogiri installation fails, it's likely your Xcode Command Line Tools are not installed correctly. Try installing the Xcode Command Line Tools from the Apple developer site, as described above in the section 'Install Xcode Command Line Tools.' The maintainers of the node-gyp build tool have provided Installation notes for macOS Catalina that are very helpful in resolving Xcode Command Line Tools installation issues. The Nokogiri maintainers also provide instructions for Installing Nokogiri.

Install Rails

Check for the current version of Rails. Rails 6.0.2 was current when this was written.

You can install Rails into the current Ruby environment.

Here are the options you have for installing Rails.

If you want to install the current stable release:

$ gem install rails

If you want the newest beta version or release candidate, you can install with --pre.

$ gem install rails --pre

Or you can get a specific version.

For example, if you want the Rails 5.2.3 release:

$ gem install rails --version=5.2.3

Verify that the correct version of Rails is installed:

$ rails -v

Rails 6.0.2

Rails is now installed. If you want, you can close the Terminal window. Everything is installed, so you won't lose anything by closing the Terminal.

Next, try building a Rails application.

Create a Workspace Folder

You'll need a convenient folder to store your Rails projects. You can give it any name, such as code/ or projects/. For this tutorial, we'll call it workspace/.

Create a projects folder and move into the folder:

$ mkdir workspace

$ cd workspace

This is where you'll create your Rails applications.

New Rails Application

Here's how to create a new Rails application.

$ rails new myapp

We'll name the new application 'myapp.' Obviously, you can give it any name you like.

The rails new command generates the default Rails starter app.

Quick Test

For a 'smoke test' to see if everything runs, display a list of Rake tasks.

$ cd myapp

$ rails -T

Run the application with the Rails server command:

$ rails server

Use your web browser to visit the application at http://localhost:3000/.

Use Control-c to stop the server.

This concludes the instructions for installing Ruby and Rails. Read on for additional advice and tips.

Terminal Application and Text Editor

The built-in Apple Terminal application is adequate but many developers install iTerm 2. It has more options for customization.

For examining and writing code, you'll also need a text editor program such as VS Code or Atom. Of course, some programmers will suggest you try Vim or Emacs.

Databases for Rails

Rails uses the SQLite database by default. MacOS come with SQLite pre-installed and there's nothing to configure.

Though SQLite is adequate for development (and even some production applications), a new Rails application can be configured for other databases. The command rails new myapp --database= will show you a list of supported databases.

Supported for preconfiguration are: mysql, oracle, postgresql, sqlite3, frontbase, ibm_db, sqlserver, jdbcmysql, jdbcsqlite3, jdbcpostgresql, jdbc.

PostgreSQL

Use the easy-to-install macOS Postgres.app if you'd like to use PostgreSQL.

To create a new Rails application to use PostgreSQL:

$ rails new myapp --database=postgresql

The --database=postgresql parameter will add the pg database adapter gem to the Gemfile and create a suitable config/database.yml file.

Deployment

Most developers deploy their applications with a 'platform as a service' (PaaS) provider such as Heroku.

See a helpful comparison of Rails hosting services.

For deployment on Heroku, see the article:

Security

By design, Rails encourages practices that avoid common web application vulnerabilities. The Rails security team actively investigates and patches vulnerabilities. If you use the most current version of Rails, you will be protected from known vulnerabilities. See the Ruby On Rails Security Guide for an overview of potential issues and watch the Ruby on Rails Security Mailing List for announcements and discussion.

Your Application's Secret Token

Rails uses a session store to provide persistence between page requests. The default session store uses cookies. To prevent decoding of cookie data and hijacking a session, Rails encrypts cookie data using a secret key. When you create a new Rails application using the rails new command, a unique secret key is generated.

The file config/master.key contains a secret token used to decrypt credentials (and other encrypted files).

Take care to hide the secret token you use in production. Don't expose it in a public GitHub repo, or people could change their session information, and potentially access your site without permission. It's best to set the secret token in a Unix shell variable.

If you need to create a new secret token:

$ rails secret

The command rake secret generates a new random secret you can use. The command won't install the key; you have to copy the key from the console output to the appropriate file.

Troubleshooting

Conflicting Bundler Versions

If you install a version of Bundler that is newer than the default installed with Ruby, you will get a message 'Warning: the running version of Bundler (2.1.2) is older than the version that created the lockfile (2.1.4)' when you run a Rails command. You can avoid the warning by prepending bundle exec, for example bundle exec rails -T. It's not possible to remove a default gem with gem uninstall bundler so it's advisable not to install a newer version of Bundler unless absolutely necesary.

Problems with 'Gem::RemoteFetcher::FetchError: SSL_connect'

Ruby and RubyGems (starting with Ruby 1.9.3p194 and RubyGems 1.8.23) require verification of server SSL certificates when Ruby makes an Internet connection via https. If you run rails new and get an error 'Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate' see this article suggesting solutions: OpenSSL errors and Rails.

Problems with 'Certificate Verify Failed'

Are you getting an error 'OpenSSL certificate verify failed' when you try to generate a new Rails app from an application template? See this article suggesting solutions: OpenSSL errors and Rails.

Installing in a Second Account

If you've created a second user account on your Mac, and the first user has already installed Homebrew, the first user may have to change permissions for the /usr/local/bin and /usr/local/Cellar folders:

$ sudo chmod g+w /usr/local/bin

$ sudo chmod g+w /usr/local/Cellar

The second user account should be given admin privileges using the System Preferences 'Users and Groups' setting.

Where to Get Help

Your best source for online help with problems is Stack Overflow. Your issue may have been encountered and addressed by others.

To find a real person who can help, attend a Ruby meetup in your city. Google for 'ruby meetup' with your city name.

Have a problem with Ruby on Rails installation? Got a suggestion for others?

(Related article: How to Install Ruby on Rails for Linux (Ubuntu))

Step 1. Upgrade Your System to OS X Mavericks

Installing Ruby on Rails is simple, but unless you have an old Mac machine (a pre ‘08 model), you should seriously consider upgrading your system to OS X Mavericks (10.9). It comes with the latest improvements from Apple, and it’s completely free! You can follow this guide for this upgrade.

Step 2. Install XCode Command Line Developer Tools

We need to first install Apple’s XCode Command Line Developer Tools, so that we can use the build tools and utilities that come with it to build Ruby gem native extensions and install other system packages.

This used to be a lengthy process, but if you are on Mavericks, all you have to do is to run this command in your terminal:

After the installation, type

and if the response has something like Apple LLVM version 5.0, you are all set.

Step 3. Install Homebrew

Homebrew is the best package manager on Mac. If you are still using MacPorts, it’s time to start brewing! To install homebrew, use this one line installer:

After it finishes, type

you should see the response as /usr/local/bin/brew

Step 4. Install Ruby with RBENV

Your Mac already ships with Ruby (we used it to install homebrew in the last step). However, it’s still a good idea to use a Ruby version manager because:

  • the system Ruby is likely outdated and you may want to use the latest Ruby version to leverage the new features
  • you may need to work on multiple projects on different Ruby Versions

RVM and RBENV are the two leading Ruby version managers. I prefer RBENV because it’s a simpler and lighter weight solution, and together with bundler, it solves the project gemset problem in a more elegant way.

Mac

We can just use homebrew to install rbenv.

rbenv by itself only manages switching ruby versions. ruby-build and rbenv-gem-rehash are both rbenv plugins. ruby-build allows you to install rubies with rbenv and rbenv-gem-rehash automatically hashes new gems for you when they are installed. You can see here to learn more about rbenv plugins.

You need to initialize rbenv by adding this line in your ~/.bashrc file.

Now you are ready to install Ruby with rbenv. At the time of this writing, the latest stable Ruby version is 2.1.0, so let’s install that.

Macrail Products

Step 5. Install Git and Set Up Github Account

Git is the version control system of choice for the Ruby community. If you followed this guide, you should already have git installed as part of the XCode Command Line Developer Tools. You may also want to install git separately with homebrew for easier upgrading.

Now tell git your name and email that it will use for your commits.

Github is the leading platform for source code hosting and collaboration. If you don’t have an account yet, go ahead and sign up for one at https://github.com. Make sure you sign up with the same email address from the step above.

For easier authentication with Github when you push or pull code, follow this guide to set up ssh keys for your Mac.

Step 6. Create a New Rails Application

If you don’t have a directory to hold all your development projects yet, you can create that directory like below:

Now you can create a Rails project in that directory:

Wait until the the last step finishes, and you just created your first Rails project! You can verify that you set up Rails by first starting the server

Now open up your browser and type in the address bar http://localhost:3000 and if you see a welcome page, your app is running locally.

Step 7. Set Up Sublime Text as Code Editor

If you already have an editor of choice, such as Vim or Emacs, you can skip this step. :) If you are not familiar with code editors, Sublime Text is an excellent choice and you can download it here.

After you install it, run the following command:

and now you can simply type

in your Rails project directory to start coding.

The convention for Ruby programs is to use two spaces as indentation. You can follow Sublime Text 2 => Preferences => Settings - User and add these lines.

Optional Step 1. Use iTerm 2, zsh and oh-my-zsh to set up an awesome terminal

Download and Install iTerm 2. It comes with more features and is easier to customize than the built in Terminal.

Now it’s time to customize your terminal! Here are some of my preferences.

Rails Form Action

  • Under “General”, check “Copy to clipboard on selection”
  • Under “Profile” => “Colors”, click on “Load Presets”, then choose “Dark Background”
  • Under “Profile” => “Text”, change the font to one that you enjoy looking at. My favorite is 20pt Anonymous Pro with Anti-aliased. You have to download it first and install it into your Mac’s font book before you can use it
  • Under “Keys”, define a hotkey to hide/show the terminal window. This is much faster than having to Command+Tab through opened windows and find iTerm 2

Zsh is an alternative shell to the default bash shell that comes with Mac. It adds nice features such as smart tab completions, but what really sets it apart is its scriptability. Together with oh-my-zsh, an open source zsh configuration management framework, it becomes really easy to customize both the look and functionality of your terminal.

Your Mac already comes with zsh. To use zsh, go to iTerm 2 => Preferences => Profiles => General and in the “Command” section, select “Command”, and type /bin/zsh in the box after it. Now close your terminal and relaunch it, you should be on zsh!

Next, let’s install oh-my-zsh:

Now you can customize the ~/.zshrc file.

  • If you have your settings in ~/.bash_profile, you may want to copy them over to /.zshrc.
  • Find the plugins=(git) line and add more plugins. Here is the plugins I am using:

If you do not like the default theme, you can pick from one of the many themes that come with oh-my-zsh. You can see the list of themes here and here.

If you feel really adventurous, you can even build your own theme! Take a look at how themes are implemented, and copy/tweak/build one exactly to your taste!

Optional step 2. Install Postgresql as a production quality database

By default, Rails uses sqlite3 as the default development database. It’s a nice database but probably not one that you want to use in production. Postgresql is a solid, production quality relational database and works well with Rails. It’s generally a good idea to set up your local database to match the database on the production environment.

The easiest way to use Postgresql on Mac is to download and install the Postgres.app

With Postgresql running, add gem 'pg' to the Gemfile in your rails project and run bundle install to install the Postgresql Ruby driver. This RailsCast talks about how to set up with Postgres in detail. You can skip the “taps” part if you don’t already have data that needs to be migrated.

Rails Format Number

Congratulations!

Rails For Mauser M18

This is it! You just made it to the end of our first rails tutorial, and have now set up your local Ruby on Rails development environment like a pro, now it’s time to start coding. :)