Install Ruby For Mac Os X



  1. Rvm Install Ruby Mac Os X
  2. Install Ruby For Mac Os X 10.13
  3. Install Ruby For Mac Os X 10 11 Download Free
  4. Ruby
  5. Install Ruby Mac Os
  1. Ruby Web Development OS X This one is tailor made for the Basix users among you. If you've been itching to try out Ruby and/or Rails, if the Terminal is somewhat new to you, you may find that even the process of installing it can generate countless confusing errors.
  2. Of course, you can also install Ruby from source on all major platforms. Compiling Ruby — Source Code Installing from the source code is a great solution for when you are comfortable enough with your platform and perhaps need specific settings for your environment.
  3. The Missing Package Manager for macOS (or Linux). It's all Git and Ruby underneath, so hack away with the knowledge that you can easily revert your modifications and merge upstream updates.

(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.

Mar 07, 2018 Then: older Mac OS versions you must run the proper ruby command with curl –insecure flag to retrieve the Homebrew install script, the proper curl flag must be used because older macOS does not have curl with HTTPS support so it has to be insecure first. After you have Ruby, Homebrew, and associated developer software, which includes the gem Gosu, ready to go, you need a programming editor for Ruby. To install Atom, follow these steps: 1 In your browser, go to Atom Installer and click the Download for Mac button.

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.

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.

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.

  • 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.

Congratulations!

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. :)

Most developers spend their first day on a new computer setting up their develoment environment. If you are a ruby developer, this article should help you get started quickly.

I’m assuming you are starting with a clean install of Mac OS X Lion. A similar environment could be created off of the same or similar tools for a Linux machine.

The pieces of this development environment are:

  • rbenv
  • ruby-build
  • ruby
  • bundler
  • rails
  • MySQL
  • redis
  • pow

This should give you a broad set of tools that will cover most development environment needs. You could easily add more tools to your environment if needed.

Install Xcode

Xcode provides many of the necessary compilers and libraries needed for your development environment.

As of Lion, this is an easy install via the Mac App Store. It is a large download so while this step is easy, it will take some time to download and install.

The following link will take you to the Mac App Store to install.

Install Homebrew

Homebrew is the easiest and most flexible way to install the UNIX tools Apple didn’t include with OS X.

To install run the following command:

You can see detailed instructions on what happens when you run this command to install here:

Remove RVM (if necessary)

Mac

If you have previously used RVM in your environment, you’ll want to get rid of this so it doesn’t interfere with your new environment. This is a simple task. Just run:

Install MySQL Server

Now that we have homebrew installed, these installations become simple single line commands.

Install Redis (optional)

Redis is an open source, advanced key-value store. It has many uses such as caching and serving as a queue for background jobs (via resque).

Once again, an easy to install with homebrew.

Install rbenv and ruby-build

The basis of this environment is rbenv which allows you to run self-contained ruby environments for each of your projects. This setup has huge advantages over a system wide install of ruby that would force you to keep all of your projects on the same version of ruby as well as gems.

I chose rbenv over rvm because it’s simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.

Use homebrew to install.

Add to ~/.bash_profile:

I like to alias the `bundle exec` command to just `b` to save some typing. If you prefer not to do that, just skip adding that line to the .bash_profile.

Restart your Terminal.

Install pow

Pow is a zero-config Rack server for Mac OS X. Instead of running the rails server manually for each of your projects, pow runs it for you and gives you a simple hostname to. So instead of going to http://localhost:3000 after starting your rails server, you can just go straight to http://project.dev (where “project” is replaced with the folder name of your project.

Note: I’ve had trouble using pow before when using custom DNS servers in my Network settings. If something isn’t working right when you try to use pow, check your DNS settings and make sure you are using the defaults.

To install pow, simply run:

You can view this script before running it on their website.

Install ruby

Now we can install our rubies. At the time of writing this I had projects running on both 1.8.7 and 1.9.3 so I’m going to show you how to setup both and set one as the global version.

Install ruby 1.9.3:

Install ruby 1.8.7:

After installing a new ruby or a global gem, you need to run the following command.

Set the global ruby to 1.9.3:

Configure your global gem settings

I typically always just use Google and the online documentation for ruby, rails, and other gems. So installing the rdoc’s for all of our gems is a waste. I prefer to disable this in a .gemrc file.

Add this line to the ~/.gemrc file:

Install bundler

Bundler manages an application’s dependencies through its entire life across many machines systematically and repeatably.

Bundler has to be installed for each version of ruby you want to run it on.

Configure bundler in ~/.bundle/config:

This line tells bundler to install my gems in a relative path specific to each project.

Rvm Install Ruby Mac Os X

Install Rails

Similar to bundler, you want to install the rails gem for each of your ruby versions.

Setup your first Rails project

Install ruby for mac os x 10.13

Now you’re ready to setup your first project. We are going to create a sample project called “blog”.

Create a projects folder if you don’t already have one.

Remember that we want to use MySQL as the database for the Rails project so we are going to pass that in with the rails command.

Set the project specific ruby version.

This sets a local per-project Ruby version by writing the version name to an .rbenv-version file in the current directory.

Now run bundler on your new project.

This will install all of the gems for this project into:

Mac

If you ever get into a situation where your gems are working correctly, you can simple delete that entire bundle directory and run bundle install again to get fresh versions of everything for your project.

To setup pow for your new rails project, just create a symbolic link to the project folder in the ~/.pow directory.

That’s it! Now you should be able to access your new project at:

Other apps you might want

Install Ruby For Mac Os X 10.13

GitHub

Install Ruby For Mac Os X 10 11 Download Free

I highly recommend using GitHub to host your projects. They offer a free app for working with git repositories and it makes it super easy to use with their service.

Sublime Text 2

This is the text editor I use and prefer. It has a lot of cool features and is very customizable.

Ruby

MySQL Workbench

Install Ruby Mac Os

MySQL offers a free app for managing your MySQL databases.