facebook twitter hatena line email

Mac/インストール/git

提供: 初心者エンジニアの簡易メモ
2017年12月25日 (月) 12:17時点におけるAdmin (トーク | 投稿記録)による版 (ターミナルにブランチ名表示)

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
移動: 案内検索

インストール

brew install git

El Capitanにした時のエラー

エラー内容

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

修正

xcode-select --install

ターミナルにブランチ名表示

以下スクリプトがあるか確認

$ ls /usr/local/etc/bash_completion.d/
git-completion.bash git-prompt.sh
$ vi ~/.bash_profile
source /usr/local/etc/bash_completion.d/git-prompt.sh
source /usr/local/etc/bash_completion.d/git-completion.bash
GIT_PS1_SHOWDIRTYSTATE=true
export PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[1;36m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\n\$ '
$ sh ~/.bash_profile

反映前

mac1-no-MacBook-Air:ssh mac1$

反映後

mac1@mac1-no-MacBook-Air:/d/ssh (master)
$

参考:http://qiita.com/yoshiokaCB/items/bbcc6a3bd7d4ca1be198

ターミナルにブランチ名表示(高機能版)

oh-my-zshのインストール

$ brew install zsh
$ curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
$ vi ~/.zshrc
ZSH_THEME="ys"
$ source ~/.zshrc
vi ~/.bashrc
source ~/.zshrc

oh-my-zshのアンインストール

$ brew remove zsh
$ uninstall_oh_my_zsh

デフォルトシェルがzshだった時bashへ直す

$ echo $SHELL
/bin/zsh
$ chsh -s /bin/bash