Development Environment Setup Guide on MacOS
Development Environment Setup Guide on MacOS
Section titled “Development Environment Setup Guide on MacOS”Introduction
Section titled “Introduction”This guide configures a comprehensive local development environment on macOS systems for the GenAI IDP accelerator.
Purpose: Delivers an automated, scripted installation of all required development tools optimized for Apple hardware, ensuring rapid setup with minimal manual configuration. This approach leverages native macOS performance while maintaining consistency with project requirements.
When to use this guide:
• You’re setting up development on a Mac for the first time
• You’re experiencing configuration issues with your current macOS setup
• You prefer automated installation over manual tool configuration
• You want to ensure exact tool versions match project specifications
What you’ll achieve:
Section titled “What you’ll achieve:”A fully functional local development environment with Python 3.13, AWS CLI, Docker Desktop, VS Code with AI extensions, and integrated development tools - all configured through a single automated setup script. This document provides a step-by-step guide to setting up a development environment on macOS. It covers installing essential tools such as VS Code, Python 3.13.x, AWS CLI, SAM CLI, Node.js, Docker Desktop, Miniconda, Cline for VS Code, and Amazon Q in Terminal.
Prerequisites
Section titled “Prerequisites”-
macOS 12+ (Monterey) recommended; Apple Silicon (M1/M2/M3) and Intel are both supported.
-
An admin account on the Mac (you may be prompted for your password).
-
Stable internet connection.
Clone the Repository
Section titled “Clone the Repository”To get the sample project locally, run:
git clone https://github.com/aws-solutions-library-samples/accelerated-intelligent-document-processing-on-aws.gitChange your directory to access the mac_setup.sh file
Quickstart (One-Command Script)
Section titled “Quickstart (One-Command Script)”If you prefer to automate everything, download the script and run:
chmod +x mac_setup.sh./mac_setup.shStep-by-Step Instructions
Section titled “Step-by-Step Instructions”1) Install Xcode Command Line Tools (and Rosetta, if needed)
Section titled “1) Install Xcode Command Line Tools (and Rosetta, if needed)”Xcode Command Line Tools provide compilers and essential build tools. Rosetta is required for some Intel-only tools on Apple Silicon.
# Install Xcode Command Line Toolsxcode-select --install 2>/dev/null || echo "Xcode CLT already installed or prompt will appear."
# (Apple Silicon only) Install Rosetta if not installedif [[ "$(uname -m)" == "arm64" ]]; then if ! /usr/bin/pgrep oahd >/dev/null 2>&1; then softwareupdate --install-rosetta --agree-to-license || true fifi2) Install Homebrew
Section titled “2) Install Homebrew”Homebrew is the package manager we will use to install most dependencies.
# Install Homebrew (skips if already installed)if ! command -v brew >/dev/null 2>&1; then /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"fi
# Add brew to PATH for current shell sessioneval "$(/opt/homebrew/bin/brew shellenv 2>/dev/null || /usr/local/bin/brew shellenv)"3) Install Visual Studio Code
Section titled “3) Install Visual Studio Code”You can install VS Code via Homebrew (recommended) or manually from Microsoft.
\# Install VS Code via Homebrew Cask\brew install \--cask visual-studio-code4) Python (pyenv + optional Miniconda)
Section titled “4) Python (pyenv + optional Miniconda)”We’ll install pyenv to manage Python versions and optionally Miniconda for data workflows. This replaces the Linux-specific alternatives/yum/dnf steps in your original script.
# Install pyenv and dependenciesbrew updatebrew install pyenv
# Initialize pyenv for zshif ! grep -q 'pyenv init' ~/.zshrc 2>/dev/null; then echo '# pyenv setup' >> ~/.zshrc echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc echo 'eval "$(pyenv init -)"' >> ~/.zshrcfi
# Use pyenv to install and set Python 3.12 (adjust if you prefer 3.11, etc.)eval "$(pyenv init -)"pyenv install -s 3.12.5pyenv global 3.12.5
# Upgrade pip and install virtualenvpython -m pip install --upgrade pippython -m pip install virtualenv
# (Optional) Miniconda via Homebrew# brew install --cask miniconda5) AWS CLI v2
Section titled “5) AWS CLI v2”On macOS, the simplest way is via Homebrew.
brew install awscli
# Testaws --version6) AWS SAM CLI
Section titled “6) AWS SAM CLI”Install SAM CLI from AWS Homebrew tap.
brew tap aws/tapbrew install aws-sam-cli
# Testsam --version7) Node.js via nvm (Node 22 LTS)
Section titled “7) Node.js via nvm (Node 22 LTS)”Use nvm to manage Node versions. This mirrors your Linux section but uses zsh-friendly profile updates.
# Install nvmif [ ! -d "$HOME/.nvm" ]; then curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bashfi
# Load nvm for current shellexport NVM_DIR="$HOME/.nvm"[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
# Install Node 22 LTSnvm install 22nvm alias default 22
# Testnode -vnpm -v8) Docker Desktop
Section titled “8) Docker Desktop”Docker Desktop is the recommended way to run containers on macOS. It includes a lightweight VM and provides Docker Engine & Compose.
brew install --cask docker
# After installation, launch Docker.app from /Applications or via Spotlight.# Give it a minute to start the backend; then test:# docker version9) Open Interpreter (optional)
Section titled “9) Open Interpreter (optional)”Install with pip. You can later configure any model/provider you want (kept generic here).
python -m pip install --upgrade open-interpreter
# Run with: interpreter10) Shell Quality-of-Life Settings (zsh)
Section titled “10) Shell Quality-of-Life Settings (zsh)”On macOS, zsh is the default shell. We’ll add a small include folder to keep the main ~/.zshrc tidy.
# Create include directory for .zshrc snippetsmkdir -p ~/.zshrc.d
# Add an include line to ~/.zshrc if not already presentif ! grep -q 'for f in ~/.zshrc.d/*.zsh' ~/.zshrc 2>/dev/null; then cat <<'EOF' >> ~/.zshrc
# Load custom zsh snippetsif [ -d "$HOME/.zshrc.d" ]; then for f in $HOME/.zshrc.d/*.zsh; do [ -r "$f" ] && source "$f" donefiEOFfi
# Create a generic preferences snippetcat <<'EOF' > ~/.zshrc.d/00-preferences.zsh# History settingssetopt APPEND_HISTORYHISTSIZE=100000SAVEHIST=100000
# Prompt (simple)PROMPT='%F{green}%n@%m%f:%F{blue}%~%f$(git_prompt_info) $ '
# Aliasesalias python=python3alias pip=pip3
# (Optional) nvm autoloadexport NVM_DIR="$HOME/.nvm"[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"EOF11) Verify Your Setup
Section titled “11) Verify Your Setup”- VS Code: Open it from Applications. Install extensions as needed (e.g., Python, Docker, AWS Toolkit).
- Python: run
python --versionandpip3 --version. - Node: run
node -vandnpm -v. - AWS CLI: run
aws --version. - SAM CLI: run
sam --version. - Docker: launch Docker.app, then run
docker versionin Terminal.
12) Install the IDP CLI
Section titled “12) Install the IDP CLI”Install the IDP CLI and all required dependencies:
make setup-venvsource .venv/bin/activateNote: This installs the
idp-clicommand along with all required Python dependencies.
13) Configure AWS CLI
Section titled “13) Configure AWS CLI”Refer this link for AWS configure
Section titled “Refer this link for AWS configure”https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html
14) Test the Build
Section titled “14) Test the Build”Using idp-cli publish
Section titled “Using idp-cli publish”Test CLI help:
idp-cli publish --helpTest standard build and publish:
idp-cli publish --source-dir . --region us-east-1Pattern-2 container images are built and pushed automatically when Pattern-2 changes are detected. Ensure Docker is running and you have ECR permissions.
Troubleshooting Build Issues:
If the build fails, use the --verbose flag to see detailed error messages:
idp-cli publish --source-dir . --region us-east-1 --verboseThe verbose flag will show:
- Exact SAM build commands being executed
- Complete error output from failed builds
- Python version compatibility issues
- Missing dependencies or configuration problems
Note: The legacy
publish.pyscript is deprecated. Useidp-cli publishfor all new builds.
- If
brewis not found, add it to PATH:
eval "$(/opt/homebrew/bin/brew shellenv 2>/dev/null || /usr/local/bin/brew shellenv)"-
If
pyenvshims don’t work, ensure its init lines are in~/.zshrcand open a new Terminal. -
On Apple Silicon, some images/tools may need Rosetta. Install it with
softwareupdate --install-rosetta --agree-to-license. -
Docker needs to be running before
dockercommands succeed. Launch Docker.app and wait for the whale icon to be steady.
Troubleshooting Tips
Section titled “Troubleshooting Tips”What it is: An AI coding assistant that runs as a VS Code extension, powered by various LLMs (Claude, GPT, etc.)
Key capabilities:
- Autonomous code editing across multiple files
- Executes terminal commands and reads file outputs
- Can browse the web for documentation/research
- Maintains context across entire codebases
- Handles complex, multi-step development tasks
Why it’s helpful: Acts like an AI pair programmer that can actually write, test, and debug code independently while you supervise.
- You can install it from “Extensions” tab on VSCode.
Amazon Q Developer
Section titled “Amazon Q Developer”What it is: AWS’s AI coding assistant integrated into IDEs, specifically designed for AWS development
Key capabilities:
- Code suggestions and completions optimized for AWS services
- Security vulnerability scanning and fixes
- AWS best practices recommendations
- Infrastructure as Code (CloudFormation, CDK) assistance
- Direct integration with AWS documentation and services
Why it’s helpful: Specialized for AWS development with deep knowledge of AWS services, perfect for this GenAI-IDP project since it’s built entirely on AWS.
- You can install it from https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-installing.html