Mac-通过Homebrew安装git

Mac-Homebrew安装

  • 关于Homebrew
  • 安装Homebrew
  • 安装Git

关于Homebrew

参照:: Homebrew.

安装Homebrew

~ $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following existing directories will be made group writable:
/usr/local/lib
==> The following existing directories will have their owner set to oblily:
/usr/local/lib
==> The following existing directories will have their group set to admin:
/usr/local/lib
==> The following new directories will be created:
/usr/local/bin
/usr/local/etc
/usr/local/include
/usr/local/sbin
/usr/local/share
/usr/local/var
/usr/local/opt
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var/homebrew
/usr/local/var/homebrew/linked
/usr/local/Cellar
/usr/local/Caskroom
/usr/local/Homebrew
/usr/local/Frameworks
==> The Xcode Command Line Tools will be installed.

Press RETURN to continue or any other key to abort

需要Xcode的命令行工具,回车后继续安装,
出现下面内容,提示安装完成

==> 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

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations
==> Next steps:
- Run `brew help` to get started
- Further documentation: 
    https://docs.brew.sh

确认版本

~ $ brew --version
Homebrew 1.9.3
Homebrew/homebrew-core (git revision d1cd; last commit 2019-02-01)

确认安装路径

~ $ cd /usr/local
/usr/local $ ls -la
total 0
drwxr-xr-x  15 root    wheel  480 Feb  1 11:13 .
drwxr-xr-x@  9 root    wheel  288 Sep 21 13:01 ..
-rw-r--r--   1 root    wheel    0 Jan 31 23:37 .com.apple.installer.keep
drwxrwxr-x   2 user  admin   64 Feb  1 11:13 Caskroom
drwxrwxr-x   2 user  admin   64 Feb  1 11:13 Cellar
drwxrwxr-x   2 user  admin   64 Feb  1 11:13 Frameworks
drwxrwxr-x  20 user  admin  640 Feb  1 11:14 Homebrew
drwxrwxr-x   3 user  admin   96 Feb  1 11:14 bin
drwxrwxr-x   3 user  admin   96 Feb  1 11:15 etc
drwxrwxr-x   2 user  admin   64 Feb  1 11:13 include
drwxrwxr-x   2 user  admin   64 Jan 24 21:47 lib
drwxrwxr-x   2 user  admin   64 Feb  1 11:13 opt
drwxrwxr-x   2 user  admin   64 Feb  1 11:13 sbin
drwxrwxr-x   5 user  admin  160 Feb  1 11:15 share
drwxrwxr-x   3 user  admin   96 Feb  1 11:13 var
/usr/local $ cd bin
/usr/local/bin $ ls -la
total 0
drwxrwxr-x   3 user  admin   96 Feb  1 11:14 .
drwxr-xr-x  15 root    wheel  480 Feb  1 11:13 ..
lrwxr-xr-x   1 user  admin   28 Feb  1 11:14 brew -> /usr/local/Homebrew/bin/brew
/usr/local/bin $ 

安装Git

brew install git

确认

/usr/local/bin $ git --version
git version 2.17.2 (Apple Git-113)

你可能感兴趣的:(Mac-通过Homebrew安装git)