0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Gitをインストールする方法

Last updated at Posted at 2020-09-30

ダウンロードしてインストールする方法

ダウンロードしてインストールする方法
# 1. yumをアップデートしておく
$ sudo yum -y update
# 2. 関連するライブラリをインストールする
$ sudo yum -y install gcc curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker autoconf
# 3. 任意のインストール場所へどうする
$ cd /path/to/dir/
# サイトから Git の圧縮ファイルをダウンロード
$ sudo wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.31.1.tar.gz
# 4. ダウンロードしたファイルを解凍する
$ sudo tar xzvf git-2.31.1.tar.gz
# 5. もういらないのでダウンロードしたファイルを削除
$ sudo rm git-2.31.1.tar.gz
# 6. 解凍したディレクトリに移動
$ cd git-2.31.1
# 7. make コマンドでインストール
$ sudo make prefix=/usr/local all
$ sudo make prefix=/usr/local install
# 8. バージョン確認で使えることを確認する
$ git --version

Homebrewでインストールする方法

  • 環境 : macOS Catalina バージョン10.15.6
# 1. (しなくてもいいけど)事前準備をする
# 1-1. アップデートしておく
% brew update
Updated 3 taps (homebrew/core, homebrew/cask and homebrew/cask-fonts).
==> Updated Formulae
...省略...

# 1-2. バージョンはこんな感じになった
% brew -v
Homebrew 2.5.2
Homebrew/homebrew-core (git revision d5fb4c; last commit 2020-09-30)
Homebrew/homebrew-cask (git revision 536b94; last commit 2020-09-30)

# 1-3. Homebrewが元気かお医者さんに聞いておく
% brew doctor 
Your system is ready to brew.

# 1-4. インストールしちゃってないか確認する
% brew list | grep git
%

# 1-5. インストールするものを選ぶ、今回はナチュラルなGitにする
% brew search git
==> Formulae
...省略...
git                          git-flow-avh   ...
...省略...

# 2. Gitをインストールする
% brew install git
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> New Casks
yggdrasil
==> Updated Casks
preform
==> Deleted Casks
brogue

==> Downloading https://homebrew.bintray.com/bottles/gettext-0.21.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/cdea54f52b7c36ebcb5fe26a1cf736d7cd6fd5f2fd016dd8357a8624ffd6b5f8?response-content-disposition=attachment%3Bfilenam
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/pcre2-10.35.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/6a1e59a5db23d684f92d2bf695601d1b466f3e9d5407f704ba4679d885d13cef?response-content-disposition=attachment%3Bfilenam
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/git-2.28.0.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/6c4d10f29f78dcbefa12fab3e47e7755d5d2ca2e9bbc5aeee4838ad223296d0a?response-content-disposition=attachment%3Bfilenam
######################################################################## 100.0%
==> Installing dependencies for git: gettext and pcre2
==> Installing git dependency: gettext
==> Pouring gettext-0.21.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/gettext/0.21: 1,953 files, 19.0MB
==> Installing git dependency: pcre2
==> Pouring pcre2-10.35.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/pcre2/10.35: 230 files, 6.0MB
==> Installing git
==> Pouring git-2.28.0.catalina.bottle.tar.gz
==> Caveats
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/git
==> Summary
🍺  /usr/local/Cellar/git/2.28.0: 1,482 files, 48.9MB
==> Caveats
==> git
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/git

# 3. インストールできた
% git --version
git version 2.24.3 (Apple Git-128)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?