Saturday, November 23, 2024

How to install Git on Mac

 Steps to install Git on Mac 



anurag@Anurags-MacBook-Air /opt % 

anurag@Anurags-MacBook-Air /opt % brew install git

==> Downloading https://formulae.brew.sh/api/formula.jws.json

######################################################################################################################################################################################################### 100.0%

==> Downloading https://formulae.brew.sh/api/cask.jws.json

######################################################################################################################################################################################################### 100.0%

==> Downloading https://ghcr.io/v2/homebrew/core/git/manifests/2.47.0

######################################################################################################################################################################################################### 100.0%

==> Fetching dependencies for git: libunistring, gettext and pcre2

==> Downloading https://ghcr.io/v2/homebrew/core/libunistring/manifests/1.3

######################################################################################################################################################################################################### 100.0%

==> Fetching libunistring

==> Downloading https://ghcr.io/v2/homebrew/core/libunistring/blobs/sha256:3cd26bae2d5fcf61294f14c18e5e7ec773a59ed1bf710fb92055e0db0244e909

######################################################################################################################################################################################################### 100.0%

==> Downloading https://ghcr.io/v2/homebrew/core/gettext/manifests/0.22.5-1

######################################################################################################################################################################################################### 100.0%

==> Fetching gettext

==> Downloading https://ghcr.io/v2/homebrew/core/gettext/blobs/sha256:9ad2a8e2fff717a18460818d086c02b8ed9f4c42a853f41a88c6f9b601b36615

######################################################################################################################################################################################################### 100.0%

==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/manifests/10.44

######################################################################################################################################################################################################### 100.0%

==> Fetching pcre2

==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/blobs/sha256:c3f9e7a70ebc0986af6f0b7c69ac1495fdf4c7420ad831d3daa9c86c448b79c2

######################################################################################################################################################################################################### 100.0%

==> Fetching git

==> Downloading https://ghcr.io/v2/homebrew/core/git/blobs/sha256:7c09abec73bcb89e12d067fb023ec7f69df73a903fa1b5eef5121a404af2694c

######################################################################################################################################################################################################### 100.0%

==> Installing dependencies for git: libunistring, gettext and pcre2

==> Installing git dependency: libunistring

==> Downloading https://ghcr.io/v2/homebrew/core/libunistring/manifests/1.3

Already downloaded: /Users/anurag/Library/Caches/Homebrew/downloads/a570da63bc1839c7e217f203abd54d4d873ebd6b99f6e88994d0e79e2ebe987c--libunistring-1.3.bottle_manifest.json

==> Pouring libunistring--1.3.arm64_sequoia.bottle.tar.gz

🍺  /opt/homebrew/Cellar/libunistring/1.3: 59 files, 5.4MB

==> Installing git dependency: gettext

==> Downloading https://ghcr.io/v2/homebrew/core/gettext/manifests/0.22.5-1

Already downloaded: /Users/anurag/Library/Caches/Homebrew/downloads/6556ea282eab4408e8a5a2be54b73c40117a4c1821978c0d109b8204e4fe8f17--gettext-0.22.5-1.bottle_manifest.json

==> Pouring gettext--0.22.5.arm64_sequoia.bottle.1.tar.gz

🍺  /opt/homebrew/Cellar/gettext/0.22.5: 2,044 files, 21.6MB

==> Installing git dependency: pcre2

==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/manifests/10.44

Already downloaded: /Users/anurag/Library/Caches/Homebrew/downloads/22ed791461c5bf400adde8c3b432c1230866aa1db3c5cb81e06a6ff21cac96ee--pcre2-10.44.bottle_manifest.json

==> Pouring pcre2--10.44.arm64_sequoia.bottle.tar.gz

🍺  /opt/homebrew/Cellar/pcre2/10.44: 237 files, 6.3MB

==> Installing git

==> Pouring git--2.47.0.arm64_sequoia.bottle.tar.gz

==> Caveats

The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.

Subversion interoperability (git-svn) is now in the `git-svn` formula.


zsh completions and functions have been installed to:

  /opt/homebrew/share/zsh/site-functions

==> Summary

🍺  /opt/homebrew/Cellar/git/2.47.0: 1,684 files, 54.4MB

==> Running `brew cleanup git`...

Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.

Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

==> Caveats

==> git

The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.

Subversion interoperability (git-svn) is now in the `git-svn` formula.


zsh completions and functions have been installed to:

  /opt/homebrew/share/zsh/site-functions

anurag@Anurags-MacBook-Air /opt % 

anurag@Anurags-MacBook-Air /opt % 

anurag@Anurags-MacBook-Air /opt % which git 

/usr/bin/git

anurag@Anurags-MacBook-Air /opt % 

How to install brew on Apple Mac ?

Steps to install brew on Mac


Go to below website : 
    https://brew.sh/

anurag@Anurags-MacBook-Air /opt % 

anurag@Anurags-MacBook-Air /opt % 

anurag@Anurags-MacBook-Air /opt % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

==> Checking for `sudo` access (which may request your password)...

Password:

==> This script will install:

/opt/homebrew/bin/brew

/opt/homebrew/share/doc/homebrew

/opt/homebrew/share/man/man1/brew.1

/opt/homebrew/share/zsh/site-functions/_brew

/opt/homebrew/etc/bash_completion.d/brew

/opt/homebrew

==> The following new directories will be created:

/opt/homebrew/bin

/opt/homebrew/etc

/opt/homebrew/include

/opt/homebrew/lib

/opt/homebrew/sbin

/opt/homebrew/share

/opt/homebrew/var

/opt/homebrew/opt

/opt/homebrew/share/zsh

/opt/homebrew/share/zsh/site-functions

/opt/homebrew/var/homebrew

/opt/homebrew/var/homebrew/linked

/opt/homebrew/Cellar

/opt/homebrew/Caskroom

/opt/homebrew/Frameworks

==> The Xcode Command Line Tools will be installed.


Press RETURN/ENTER to continue or any other key to abort:

==> /usr/bin/sudo /usr/bin/install -d -o root -g wheel -m 0755 /opt/homebrew

==> /usr/bin/sudo /bin/mkdir -p /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks

==> /usr/bin/sudo /bin/chmod ug=rwx /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks

==> /usr/bin/sudo /bin/chmod go-w /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions

==> /usr/bin/sudo /usr/sbin/chown anurag /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks

==> /usr/bin/sudo /usr/bin/chgrp admin /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks

==> /usr/bin/sudo /usr/sbin/chown -R anurag:admin /opt/homebrew

==> /usr/bin/sudo /bin/mkdir -p /Users/anurag/Library/Caches/Homebrew

==> /usr/bin/sudo /bin/chmod g+rwx /Users/anurag/Library/Caches/Homebrew

==> /usr/bin/sudo /usr/sbin/chown -R anurag /Users/anurag/Library/Caches/Homebrew

==> Searching online for the Command Line Tools

==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress


==> Installing Command Line Tools for Xcode-16.1

==> /usr/bin/sudo /usr/sbin/softwareupdate -i Command\ Line\ Tools\ for\ Xcode-16.1

Software Update Tool


Finding available software


Downloading Command Line Tools for Xcode

Downloaded Command Line Tools for Xcode

Installing Command Line Tools for Xcode

Done with Command Line Tools for Xcode

Done.

==> /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools

==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress

==> Downloading and installing Homebrew...

remote: Enumerating objects: 286212, done.

remote: Counting objects: 100% (17267/17267), done.

remote: Compressing objects: 100% (891/891), done.

remote: Total 286212 (delta 16542), reused 16714 (delta 16346), pack-reused 268945 (from 1)

remote: Enumerating objects: 55, done.

remote: Counting objects: 100% (34/34), done.

remote: Total 55 (delta 33), reused 33 (delta 33), pack-reused 21 (from 1)

==> Updating Homebrew...

==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:303bed4c7fc431a685db3c3c151d873740114adbdccd23762ea2d1e39ea78f47

######################################################################################################################################################################################################### 100.0%

==> Pouring portable-ruby-3.3.6.arm64_big_sur.bottle.tar.gz

Warning: /opt/homebrew/bin is not in your PATH.

  Instructions on how to configure your shell for Homebrew

  can be found in the 'Next steps' section below.

==> Installation successful!


==> Homebrew has enabled anonymous aggregate formulae and cask analytics.

Read the analytics documentation (and how to opt-out) here:

  https://docs.brew.sh/Analytics

No analytics data has been sent yet (nor will any be during this install run).


==> Homebrew is run entirely by unpaid volunteers. Please consider donating:

  https://github.com/Homebrew/brew#donations


==> Next steps:

- Run these commands in your terminal to add Homebrew to your PATH:

    echo >> /Users/anurag/.zprofile

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

    eval "$(/opt/homebrew/bin/brew shellenv)"

- Run brew help to get started

- Further documentation:

    https://docs.brew.sh


anurag@Anurags-MacBook-Air /opt % 

anurag@Anurags-MacBook-Air /opt % echo >> /Users/anurag/.zprofile

anurag@Anurags-MacBook-Air /opt % echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/anurag/.zprofile

anurag@Anurags-MacBook-Air /opt % eval "$(/opt/homebrew/bin/brew shellenv)"

anurag@Anurags-MacBook-Air /opt %  




anurag@Anurags-MacBook-Air /opt % 

anurag@Anurags-MacBook-Air /opt % 

anurag@Anurags-MacBook-Air /opt % which brew

/opt/homebrew/bin/brew

anurag@Anurags-MacBook-Air /opt % brew help

Example usage:

  brew search TEXT|/REGEX/

  brew info [FORMULA|CASK...]

  brew install FORMULA|CASK...

  brew update

  brew upgrade [FORMULA|CASK...]

  brew uninstall FORMULA|CASK...

  brew list [FORMULA|CASK...]


Troubleshooting:

  brew config

  brew doctor

  brew install --verbose --debug FORMULA|CASK


Contributing:

  brew create URL [--no-fetch]

  brew edit [FORMULA|CASK...]


Further help:

  brew commands

  brew help [COMMAND]

  man brew

  https://docs.brew.sh

anurag@Anurags-MacBook-Air /opt %