--- layout: default title: Set Up macOS for Vibe Coding description: A beginner-friendly guide to installing Git, PHP, Composer, VS Code, Claude Code, and Codex for building PhPstrap projects on a Mac. -------------------------------------------------------------------------------------------------------------------------------------------------

🍎 Vibe Coding with PhPstrap on macOS

This beginner-friendly guide will help you prepare a Mac for building websites and applications with PhPstrap and an AI coding agent such as Claude Code or Codex.

Never used Terminal before? That is okay. Every command in this guide can be copied into the Terminal application included with your Mac.
The minimum recommended setup: Apple Command Line Tools, Git, PHP, Composer, Visual Studio Code, and one AI coding agent. Node.js is optional. WP-CLI is not required for PhPstrap.

1) What Is Vibe Coding?

Vibe coding means using an AI coding agent to help you plan, write, explain, test, and improve code. Instead of manually writing every line, you describe what you want to build and work with the agent to create it.

An AI coding agent can:

AI can make mistakes. Always review its changes, test your project, and use Git so you can undo anything that goes wrong.

2) What You Need

Tool Required? What It Does
Terminal Included with macOS Runs the commands in this guide.
Apple Command Line Tools Yes Installs Git and development tools used by Homebrew.
Homebrew Recommended Makes it easier to install PHP and other development tools.
Git Yes Tracks your changes and lets you undo mistakes.
Visual Studio Code Recommended Provides an easy place to view and edit project files.
PHP Yes Runs PhPstrap and your PHP application.
Composer Recommended Installs and manages third-party PHP packages.
Claude Code or Codex Choose at least one Acts as your AI coding assistant inside the project.
Node.js Optional Runs JavaScript tools, npm packages, and frontend build systems.
MySQL or MariaDB Full PhPstrap only Stores users, settings, modules, and application data.
WP-CLI No Manages WordPress. It is not required for a normal PhPstrap project.

3) A Few Terms to Know


4) Check Your Mac

Open the Apple menu and select About This Mac to see your macOS version and processor.

You can also check from Terminal:

sw_vers
uname -m

The processor command will normally display:

The commands in this guide work with both types unless otherwise noted.

Homebrew support depends on your macOS version. Check the current Homebrew requirements if you are using an older Mac.

5) Open Terminal

  1. Open Finder.
  2. Open Applications.
  3. Open the Utilities folder.
  4. Double-click Terminal.

You can also press Command + Space, type Terminal, and press Return.

Check which shell you are using:

echo $SHELL

Most modern Macs will display:

/bin/zsh

6) Install Apple Command Line Tools

Apple Command Line Tools include Git and other utilities needed for local development and Homebrew.

Run:

xcode-select --install

A macOS window will appear. Select Install and follow the instructions.

After installation, verify the tools:

xcode-select -p
git --version

You should see a Command Line Tools folder and a Git version number.

You do not need to install the complete Xcode application for ordinary PhPstrap development. The smaller Command Line Tools package is normally enough.

7) Install Homebrew

Homebrew makes it easier to install and update PHP, Composer, Node.js, databases, and other development tools.

Copy the official installation command into Terminal:

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

The installer will explain what it plans to do and may ask for your Mac password.

When entering your Mac password in Terminal, no dots or characters will appear. This is normal. Type the password and press Return.

At the end of the installation, Homebrew may display one or two commands under Next steps. Copy and run those commands exactly as shown.

Then check Homebrew:

brew --version

If the brew command is not found

Run the following block. It detects the standard Homebrew location for Apple Silicon and Intel Macs:

if [[ -x /opt/homebrew/bin/brew ]]; then
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME/.zprofile"
    eval "$(/opt/homebrew/bin/brew shellenv)"
elif [[ -x /usr/local/bin/brew ]]; then
    echo 'eval "$(/usr/local/bin/brew shellenv)"' >> "$HOME/.zprofile"
    eval "$(/usr/local/bin/brew shellenv)"
fi

Check again:

brew --version
brew doctor

Official website: Homebrew.


8) Install and Configure Git

Apple Command Line Tools include Git. You can check it with:

git --version

You can optionally install the current Homebrew version:

brew install git

Configure the name and email that Git will add to your saved changes:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main

Check the configuration:

git config --global --list
You may use a GitHub private email address if you do not want your normal email address included in public commits.

9) Install Visual Studio Code

Visual Studio Code, usually called VS Code, lets you browse and edit the files in your project.

Install it with Homebrew:

brew install --cask visual-studio-code

Open VS Code from the Applications folder.

Enable the code command

To open VS Code from Terminal:

  1. Open Visual Studio Code.
  2. Press Command + Shift + P.
  3. Type shell command.
  4. Select Shell Command: Install 'code' command in PATH.
  5. Close and reopen Terminal.

Check the command:

code --version

You will later be able to open a project with:

code .

Official instructions: Visual Studio Code for macOS.


10) Install PHP

PhPstrap requires PHP 8.1 or newer. PHP 8.3 is a good choice for compatibility.

First, check whether PHP is already available:

php -v

Install PHP 8.3 with Homebrew:

brew install php@8.3

Add PHP 8.3 to your PATH:

echo 'export PATH="$(brew --prefix php@8.3)/bin:$(brew --prefix php@8.3)/sbin:$PATH"' >> "$HOME/.zprofile"
source "$HOME/.zprofile"

Check the version and location:

php -v
which php

The location should normally begin with either:

/opt/homebrew/

Or:

/usr/local/

Check your PHP extensions

Display the extensions currently enabled:

php -m

Full PhPstrap installations commonly require:

Find the PHP configuration file being used:

php --ini

See System Requirements for the complete list.


11) Install Composer

Composer manages PHP packages. An AI agent may use Composer when adding libraries for email, APIs, payments, environment variables, testing, or other features.

First, check whether Composer is already installed:

composer --version

If it is not installed, create a personal command folder:

mkdir -p "$HOME/.local/bin"

Download and verify the official Composer installer:

EXPECTED_CHECKSUM="$(curl -fsSL https://composer.github.io/installer.sig)"

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"

if [[ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]]; then
    echo "Composer installer verification failed."
    rm -f composer-setup.php
    exit 1
fi

php composer-setup.php \
    --install-dir="$HOME/.local/bin" \
    --filename=composer

rm -f composer-setup.php

Add your personal command folder to the PATH:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.zprofile"
source "$HOME/.zprofile"

Check Composer:

composer --version
composer diagnose
Only run composer install inside a project that contains a composer.json file.

Official instructions: Download Composer.


12) Install Node.js — Optional

Node.js is not required to run PHP or PhPstrap. The native macOS installers for Claude Code and Codex also do not require Node.js.

You may still want Node.js if your project uses:

Install Node.js with Homebrew:

brew install node

Check the installation:

node --version
npm --version

Official website: Node.js.


13) Choose an AI Coding Agent

You only need one coding agent to begin. Installing both is optional.

The commands below download and run installation scripts. Only use installation commands from the official Anthropic and OpenAI domains shown in this guide.

Option A: Claude Code

Install Claude Code using its recommended native macOS installer:

curl -fsSL https://claude.ai/install.sh | bash

Close and reopen Terminal, then check the installation:

claude --version
claude doctor

Start Claude Code:

claude

The first launch will guide you through signing in.

Alternative Claude Code installation with Homebrew

You can instead install the stable Homebrew release:

brew install --cask claude-code

Use either the native installer or Homebrew. You do not need to install Claude Code twice.

Official instructions: Claude Code Quickstart.

Option B: Codex

Install Codex using its native macOS installer:

curl -fsSL https://chatgpt.com/codex/install.sh | sh

Close and reopen Terminal, then check the installation:

codex --version

Start Codex:

codex

The first launch will guide you through signing in with your ChatGPT account or another available sign-in method.

Alternative Codex installation with npm

If you already installed Node.js, Codex can also be installed with:

npm install -g @openai/codex

Use either the native installer or npm. You do not need to install Codex twice.

Official instructions: Codex CLI.


14) Do You Need WP-CLI?

No. WP-CLI is designed for managing WordPress websites. PhPstrap is a standalone PHP framework and does not use WordPress.

You only need WP-CLI if you are also working on a WordPress project and want to manage:

For normal PhPstrap development, skip WP-CLI.

15) Download PhPstrap

Create a folder for your coding projects:

mkdir -p "$HOME/Projects"
cd "$HOME/Projects"

Clone the PhPstrap repository:

git clone https://github.com/PhPstrap/phpstrap.git my-phpstrap-app
cd my-phpstrap-app

Open the project in VS Code:

code .

If the project contains a composer.json file, install its PHP packages:

if [[ -f composer.json ]]; then
    composer install
fi
You can also download PhPstrap as a ZIP file, but cloning it with Git gives you better change tracking and makes it easier to receive updates.

16) Run PhPstrap Locally

From inside the project folder, start PHP’s built-in development server:

php -S localhost:8000 -t .

Open the following address in your browser:

http://localhost:8000

For a new full installation, open:

http://localhost:8000/install.php

Press Control + C in Terminal when you want to stop the server.

Full PhPstrap installations require a MySQL or MariaDB database. See the Installation Guide for database setup. PhPstrap Lite does not require a database.

17) Start Your AI Agent

Keep the PHP development server running. Open a second Terminal window and return to your project:

cd "$HOME/Projects/my-phpstrap-app"

Confirm that you are in the correct folder:

pwd
ls

Start the agent you installed:

claude

Or:

codex
Always start the coding agent from inside the correct project folder. Otherwise, it may read or modify unrelated files.

18) Your First PhPstrap Prompt

Start by asking the agent to inspect the project without changing anything:

Read this PhPstrap project and explain its structure to me as a beginner.

Do not change any files yet.

Please explain:
1. How pages are created.
2. Where shared headers and footers are stored.
3. Where configuration is stored.
4. How modules work.
5. Which files I should avoid editing directly.
6. How I can run and test the project locally.

Once you understand the structure, try a small task:

Create a simple About page for this PhPstrap project.

Before changing anything:
1. Tell me which files you plan to create or edit.
2. Follow the existing PhPstrap structure and Bootstrap 5 styles.
3. Do not modify configuration files or credentials.
4. Keep the change small and beginner-friendly.
5. Run PHP syntax checks on every PHP file you change.
6. Explain the completed changes when finished.

19) Use Git as Your Safety Net

Create a separate branch before asking the AI to make significant changes:

git switch -c feature/my-first-page

See which files have changed:

git status
git diff

After testing a successful change, save it:

git add .
git commit -m "feat: add first PhPstrap page"

See your saved changes:

git log --oneline
Commit after each working feature. Small commits are much easier to understand and undo than one enormous commit.

20) A Safe Vibe Coding Workflow

  1. Describe the goal: Explain what you want to build and who will use it.
  2. Ask for a plan: Have the agent list the files it expects to change.
  3. Make one small change: Avoid building an entire application in one prompt.
  4. Review the diff: Run git diff before accepting the work.
  5. Test in your browser: Check forms, links, mobile layout, and error messages.
  6. Check PHP syntax: Make sure changed PHP files contain no syntax errors.
  7. Commit working code: Save a known-good point with Git.
  8. Repeat: Move to the next small feature.

Useful instructions to include in prompts

Follow the existing PhPstrap project structure.

Use Bootstrap 5 components and utilities.

Do not hardcode passwords, API keys, or database credentials.

Do not edit vendor files or third-party packages directly.

Use prepared database statements.

Escape output before displaying user-provided content.

Add CSRF protection to forms that change data.

Run php -l on every PHP file you modify.

Explain any command before running it.

Do not delete files unless they are clearly no longer required.

21) Protect Passwords and API Keys

Never paste real passwords, private keys, database credentials, payment keys, or production API tokens into an AI prompt.

Example placeholder configuration:

DB_HOST=localhost
DB_NAME=example_database
DB_USER=example_user
DB_PASSWORD=replace_with_real_password
If a real password or API key is accidentally committed, removing it from the visible file is not enough. Revoke or rotate the exposed credential.

22) Check That Everything Works

Run the following commands one at a time:

xcode-select -p
brew --version
git --version
php -v
composer --version
code --version

Run the command for the AI agent you installed:

claude --version

Or:

codex --version

If you installed Node.js, also run:

node --version
npm --version

Check the current project:

cd "$HOME/Projects/my-phpstrap-app"
git status
php -S localhost:8000 -t .

23) Common Problems

“Command not found”

Examples:

zsh: command not found: composer
zsh: command not found: claude
zsh: command not found: codex

Reload your Terminal configuration:

source "$HOME/.zprofile"

Then check whether the program can be found:

which brew
which git
which php
which composer
which code
which claude
which codex

If it is still unavailable, close every Terminal window and open Terminal again.

Homebrew is installed but brew is not found

For Apple Silicon Macs:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME/.zprofile"
eval "$(/opt/homebrew/bin/brew shellenv)"

For Intel Macs:

echo 'eval "$(/usr/local/bin/brew shellenv)"' >> "$HOME/.zprofile"
eval "$(/usr/local/bin/brew shellenv)"

Then run:

brew --version

The code command is not found

  1. Open Visual Studio Code.
  2. Press Command + Shift + P.
  3. Search for Shell Command: Install 'code' command in PATH.
  4. Run it and reopen Terminal.

The wrong PHP version is running

Check the version and location:

php -v
which php
brew --prefix php@8.3

Reload your profile:

source "$HOME/.zprofile"

Confirm that the PHP 8.3 PATH line exists:

grep "php@8.3" "$HOME/.zprofile"

Composer is using the wrong PHP version

which php
php -v
which composer
composer diagnose

Composer uses the PHP command currently found in your PATH.

A required PHP extension is missing

php --ini
php -m

Check the loaded php.ini file and the PhPstrap system requirements. Restart the PHP development server after changing PHP configuration.

Port 8000 is already being used

Start the server on another port:

php -S localhost:8001 -t .

Then visit:

http://localhost:8001

You can see what is using port 8000 with:

lsof -i :8000

Terminal cannot access a folder

macOS may ask permission before Terminal can access folders such as Desktop, Documents, or Downloads. Select Allow when prompted.

You can review permissions under:

System Settings → Privacy & Security → Files and Folders
Do not grant Full Disk Access unless it is genuinely required. Normal PhPstrap development inside ~/Projects should not need it.

The AI agent cannot see the project

Check your current folder:

pwd
ls

Return to the PhPstrap project before starting the agent:

cd "$HOME/Projects/my-phpstrap-app"
claude

Or:

cd "$HOME/Projects/my-phpstrap-app"
codex

The page shows a database error

The full version of PhPstrap requires MySQL or MariaDB. Confirm:


24) Beginner Setup Checklist


25) What to Do Next

Your Mac is now ready for local PhPstrap development and AI-assisted vibe coding.

Start small, review every change, and let Git protect your progress.