Skip to content

Instantly share code, notes, and snippets.

@soroushm
Last active October 4, 2025 09:29
Show Gist options
  • Select an option

  • Save soroushm/0ce136069ce7a792fd28e7f7d646fc3d to your computer and use it in GitHub Desktop.

Select an option

Save soroushm/0ce136069ce7a792fd28e7f7d646fc3d to your computer and use it in GitHub Desktop.

Revisions

  1. soroushm revised this gist Oct 4, 2025. 1 changed file with 9 additions and 6 deletions.
    15 changes: 9 additions & 6 deletions en.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,11 @@
    ## Install **CocoaPods** on a Mac


    To install **CocoaPods** on a Mac with an **M1, M2, M3, M4 chip** (Apple Silicon, ARM architecture), the process is almost the same as on an Intel Mac, but there are a few things to keep in mind regarding Ruby compatibility and Homebrew setup. Here’s the recommended approach:

    ---

    ## 🔧 Step 1: Install Homebrew (if not already installed)
    ### 🔧 Step 1: Install Homebrew (if not already installed)

    Homebrew makes managing dependencies much easier.
    Open **Terminal** and run:
    @@ -20,7 +23,7 @@ eval "$(/opt/homebrew/bin/brew shellenv)"

    ---

    ## 🔧 Step 2: Install Ruby (via rbenv or Homebrew)
    ### 🔧 Step 2: Install Ruby (via rbenv or Homebrew)

    CocoaPods is a Ruby gem. macOS ships with Ruby, but it can cause permission issues. It’s safer to install your own Ruby version.

    @@ -44,7 +47,7 @@ If you go this route, you’ll need to use `sudo` when installing gems.

    ---

    ## 🔧 Step 3: Install CocoaPods
    ### 🔧 Step 3: Install CocoaPods

    Now install CocoaPods:

    @@ -61,7 +64,7 @@ sudo gem install cocoapods

    ---

    ## 🔧 Step 4: Verify Installation
    ### 🔧 Step 4: Verify Installation

    Check that CocoaPods installed correctly:

    @@ -71,7 +74,7 @@ pod --version

    ---

    ## ⚡ Common Issues on Apple Silicon (M1/M2/M3/M4)
    ### ⚡ Common Issues on Apple Silicon (M1/M2/M3/M4)

    * **Wrong Ruby version**: If you see errors about Ruby compatibility, install via `rbenv` or `brew install ruby`.
    * **Permission errors**: Usually fixed by not using the system Ruby.
    @@ -85,4 +88,4 @@ pod --version

    **Best Practice for Macs**: Use **Homebrew + rbenv** to manage Ruby, then install CocoaPods via `gem install cocoapods`. This avoids permission issues and future-proofs your setup.

    ---

  2. soroushm renamed this gist Oct 4, 2025. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. soroushm created this gist Oct 2, 2025.
    88 changes: 88 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,88 @@
    To install **CocoaPods** on a Mac with an **M1, M2, M3, M4 chip** (Apple Silicon, ARM architecture), the process is almost the same as on an Intel Mac, but there are a few things to keep in mind regarding Ruby compatibility and Homebrew setup. Here’s the recommended approach:

    ---

    ## 🔧 Step 1: Install Homebrew (if not already installed)

    Homebrew makes managing dependencies much easier.
    Open **Terminal** and run:

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

    After installation, make sure Homebrew’s path is set up correctly:

    ```bash
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc
    eval "$(/opt/homebrew/bin/brew shellenv)"
    ```

    ---

    ## 🔧 Step 2: Install Ruby (via rbenv or Homebrew)

    CocoaPods is a Ruby gem. macOS ships with Ruby, but it can cause permission issues. It’s safer to install your own Ruby version.

    **Option A: Use rbenv (recommended)**

    ```bash
    brew install rbenv ruby-build
    rbenv install 3.2.2 # or latest stable Ruby
    rbenv global 3.2.2
    ```

    Then add rbenv to your shell:

    ```bash
    echo 'eval "$(rbenv init - zsh)"' >> ~/.zshrc
    source ~/.zshrc
    ```

    **Option B: Use system Ruby** (not recommended, but works if you don’t want extra tools).
    If you go this route, you’ll need to use `sudo` when installing gems.

    ---

    ## 🔧 Step 3: Install CocoaPods

    Now install CocoaPods:

    ```bash
    gem install cocoapods
    ```

    If you’re using rbenv, you won’t need `sudo`.
    If you’re on system Ruby, you might need:

    ```bash
    sudo gem install cocoapods
    ```

    ---

    ## 🔧 Step 4: Verify Installation

    Check that CocoaPods installed correctly:

    ```bash
    pod --version
    ```

    ---

    ## ⚡ Common Issues on Apple Silicon (M1/M2/M3/M4)

    * **Wrong Ruby version**: If you see errors about Ruby compatibility, install via `rbenv` or `brew install ruby`.
    * **Permission errors**: Usually fixed by not using the system Ruby.
    * **Xcode command-line tools**: Make sure they’re installed:

    ```bash
    xcode-select --install
    ```

    ---

    ✅ **Best Practice for Macs**: Use **Homebrew + rbenv** to manage Ruby, then install CocoaPods via `gem install cocoapods`. This avoids permission issues and future-proofs your setup.

    ---