Rails and its supporting cast of web servers and databases thrive on the rich Mac OS X environment. The premier text editor favored by legions of Rails programmers everywhere is TextMate, a Cocoa application. And all members of the Rails core development team work with Macs. I've written an in depth guide to installing Ruby on Rails on Mac OS X 10.9 Mavericks. It's here: Install Ruby on Rails Mac OS X Mavericks. It explains how to set up the Mac (with Xcode Command Tools), install Ruby with RVM (the Ruby Version Manager), and install Rails, with advice about updating important gems and setting up a professional development environment.
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
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.
Multiplatform template
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.
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)
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.
Install Rails
Similar to bundler, you want to install the rails gem for each of your ruby versions.
Setup your first Rails project
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:
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
Rails For Mac Os X 10.10
GitHub
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.
Rails For Mac Os X 10.8
Sublime Text 2
Rails For Mac Os X 10.13
This is the text editor I use and prefer. It has a lot of cool features and is very customizable.
Rails For Mac Os X 10.7
MySQL Workbench
MySQL offers a free app for managing your MySQL databases.