How to Set Up Claude Code from Scratch on a Mac

How to Set Up Claude Code from Scratch on a Mac

Nimble Labs
Developer Guide

A complete step-by-step guide to setting up Ruby on Rails development with Claude Code on a fresh Mac — from Homebrew to your first running app.

Introduction


In this guide, we'll walk you through everything you need to install on a fresh Mac to start building Ruby on Rails applications with Claude Code as your AI pair programmer. By the end, you'll have a fully working development environment and a starter Rails app ready to go.

Here is what we will be setting up:

  1. Homebrew (Mac package manager)
  2. Git (version control)
  3. RVM & Ruby (Ruby version manager and language)
  4. PostgreSQL (database)
  5. Node.js & Yarn (JavaScript runtime and package manager)
  6. Claude Code (AI coding assistant)
  7. Rails AI Starter Application

Let's get started!

Step 1 — Install Homebrew


Homebrew is the go-to package manager for macOS. It makes installing developer tools effortless. Open Terminal and run:

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

Follow the on-screen prompts. Once it finishes, you're ready to install everything else.

Step 2 — Install Git


Git is the industry-standard version control system. Install it via Homebrew:

brew install git

Step 3 — Install RVM and Ruby


RVM (Ruby Version Manager) lets you install and switch between multiple Ruby versions. First, install RVM:

curl -sSL https://get.rvm.io | bash -s stable

Then load RVM into your current shell session:

source ~/.rvm/scripts/rvm

Now install Ruby and set it as the default:

rvm install 3.4.8
rvm use 3.4.8 --default

Step 4 — Install PostgreSQL


PostgreSQL is a powerful, open-source relational database. Install and start it with Homebrew:

brew install postgresql@17
brew services start postgresql@17

The brew services command ensures PostgreSQL starts automatically when your Mac boots up.

Step 5 — Install Node.js and Yarn


Modern Rails apps use Node.js for JavaScript tooling and Yarn for package management:

brew install node

Then install Yarn globally:

npm install -g yarn

Step 6 — Verify Your Installation


Before moving on, let's make sure everything was installed correctly. Run these commands and confirm you see version numbers for each:

git --version
ruby -v
node -v
npm -v

If any of these fail, revisit the corresponding step above.

Step 7 — Install Claude Code


Claude Code is Anthropic's agentic coding tool that lives in your terminal. It can understand your entire codebase, write features, fix bugs, and handle git workflows — all through natural language. Install it globally via npm:

npm install -g @anthropic-ai/claude-code

After installation you can launch it in any project directory by simply running claude in your terminal. You'll need either a pro account or an Anthropic API key to authenticate on first use.

Step 8 — Clone the Rails AI Starter App


Now let's get a real Rails application running. We've prepared a starter template that comes pre-configured with AI capabilities, authentication, and a modern frontend stack:

git clone https://github.com/NimbleLabs/rails-ai-starter.git
cd rails-ai-starter

Run the setup script to install dependencies, create the database, and get everything ready:

bin/setup

Run the setup script to install dependencies, create the database, and get everything ready:

bin/setup

That's it! You now have a fully configured Rails development environment with Claude Code at your fingertips. Fire up the server with bin/dev and start building.


After running bin/setup you can view the application at http://localhost:3000.

What's Next?


Now that your environment is set up, here are some things to try:

  1. Run claude in your project directory and ask it to explain the codebase
  2. Try adding a new feature by describing it in natural language
  3. Use Claude Code to write and run your tests
  4. Explore the Rails AI Starter's built-in AI chat functionality

Happy coding!