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:
- Homebrew (Mac package manager)
- Git (version control)
- RVM & Ruby (Ruby version manager and language)
- PostgreSQL (database)
- Node.js & Yarn (JavaScript runtime and package manager)
- Claude Code (AI coding assistant)
- 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.
What's Next?
Now that your environment is set up, here are some things to try:
- Run claude in your project directory and ask it to explain the codebase
- Try adding a new feature by describing it in natural language
- Use Claude Code to write and run your tests
- Explore the Rails AI Starter's built-in AI chat functionality
Happy coding!