Git Installation on macOS

Installing Git on macOS

This guide walks you through installing Git on your macOS machine for use with RStudio and GitHub. I recommend using Homebrew for the easiest installation.

!! At LJMU managed computers, install Git either from Company Portal or App Player (older).

Method 2: Using the Official Installer (Alternative)

  1. Download the Installer
  2. Run the Installer
    • Locate the downloaded .dmg file and double-click it.
    • Double-click the .pkg file in the opened window to start the installer.
  3. Follow the Installation Wizard Prompts
    • Click Continue through the steps.
    • Enter your macOS administrator password when prompted.
  4. Verify Installation in RStudio
    • Important: Close and reopen RStudio (or its terminal pane) to update the PATH environment variable.
    • Open a new terminal in RStudio: Tools > Terminal > New Terminal.
    • Type git --version and press Enter. You should see the Git version (e.g., git version 2.43.0). ! If you want to copy and paste, but it doesn’t work with Ctrl + V or Cmd + V, use Shift + Insert, or Edit->Paste

RStudio, Git, and GitHub Workflow

To use Git and GitHub with RStudio, follow these steps:

  1. Start/Update Project: Create or update an RStudio project locally.
  2. Edit Code: Write or modify R code in RStudio.
  3. Save & Stage: Save changes and stage them with git add.
  4. Commit Changes: Commit staged changes with git commit.
  5. Push to GitHub: Push commits to a GitHub repository with git push.
  6. Sync with GitHub: Ensure the GitHub repository reflects local changes.
  7. Pull Changes: Pull updates from GitHub with git pull.

Proceed with GitHub Complete workflow | Return to Section Overview