(Related article: How to Install Ruby on Rails for Linux (Ubuntu))
Dash is an API Documentation Browser and Code Snippet Manager. Dash searches offline documentation of 200+ APIs and stores snippets of code. You can also generate your own documentation sets. Rails and OS X: How to install rmagick? Ask Question Asked 7 years, 6 months ago. Active 1 month ago. Viewed 35k times 35. I am already completely desperate - I spent whole day with trying to install rmagick gem to Mac OS X Lion, but literally it's a tragedy. I saw many similar threads on Google, but nothing has helped me.
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.
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:
Rails For Mac Os X 10.10
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. :)
With an all-new design that looks great on macOS Big Sur, Xcode 12 has customizable font sizes for the navigator, streamlined code completion, and new document tabs. Xcode 12 builds Universal apps by default to support Mac with Apple Silicon, often without changing a single line of code.
Designed for macOS Big Sur.
Xcode 12 looks great on macOS Big Sur, with a navigator sidebar that goes to the top of the window and clear new toolbar buttons. The navigator defaults to a larger font that’s easier to read, while giving you multiple size choices. New document tabs make it easy to create a working set of files within your workspace.
Document tabs.
The new tab model lets you open a new tab with a double-click, or track the selected file as you click around the navigator. You can re-arrange the document tabs to create a working set of files for your current task, and configure how content is shown within each tab. The navigator tracks the open files within your tabs using strong selection.
Navigator font sizes.
The navigator now tracks the system setting for “Sidebar icon size” used in Finder and Mail. You can also choose a unique font size just for Xcode within Preferences, including the traditional dense information presentation, and up to large fonts and icon targets.
Code completion streamlined.
A new completion UI presents only the information you need, taking up less screen space as you type. And completions are presented much faster, so you can keep coding at maximum speed.
Redesigned organizer.
An all-new design groups all critical information about each of your apps together in one place. Choose any app from any of your teams, then quickly navigate to inspect crash logs, energy reports, and performance metrics, such as battery consumption and launch time of your apps when used by customers.
SwiftUI
Rails For Mac Os X 10.7
SwiftUI offers new features, improved performance, and the power to do even more, all while maintaining a stable API that makes it easy to bring your existing SwiftUI code forward into Xcode 12. A brand new life cycle management API for apps built with SwiftUI lets you write your entire app in SwiftUI and share even more code across all Apple platforms. And a new widget platform built on SwiftUI lets you build widgets that work great on iPad, iPhone, and Mac. Your SwiftUI views can now be shared with other developers, and appear as first-class controls in the Xcode library. And your existing SwiftUI code continues to work, while providing faster performance, better diagnostics, and access to new controls.
Universal app ready.
Xcode 12 is built as a Universal app that runs 100% natively on Intel-based CPUs and Apple Silicon for great performance and a snappy interface.* It also includes a unified macOS SDK that includes all the frameworks, compilers, debuggers, and other tools you need to build apps that run natively on Apple Silicon and the Intel x86_64 CPU.
Updated automatically
When you open your project in Xcode 12, your app is automatically updated to produce release builds and archives as Universal apps. When you build your app, Xcode produces one binary “slice” for Apple Silicon and one for the Intel x86_64 CPU, then wraps them together as a single app bundle to share or submit to the Mac App Store. You can test this at any time by selecting “Any Mac” as the target in the toolbar.
Test multiple architectures.
On the new Mac with Apple Silicon, you can run and debug apps running on either the native architecture or on Intel virtualization by selecting “My Mac (Rosetta)” in the toolbar.
Rails For Mac Os X 10.8
Multiplatform template
Rails For Mac Os X 10.13
New multiplatform app templates set up new projects to easily share code among iOS, iPadOS, and macOS using SwiftUI and the new lifecycle APIs. The project structure encourages sharing code across all platforms, while creating special custom experiences for each platform where it makes sense for your app.
Improved auto-indentation
Swift code is auto-formatted as you type to make common Swift code patterns look much better, including special support for the “guard” command.
StoreKit testing
New tools in Xcode let you create StoreKit files that describe the various subscription and in-app purchase products your app can offer, and create test scenarios to make sure everything works great for your customers — all locally testable on your Mac.
Get started.
Download Xcode 12 and use these resources to build apps for all Apple platforms.