1 minute read

Install Homebrew (package manager) for macOS

I believe almost all iOS developers use Homebrew (brew command line package manager) for installing dev-tools needed for their daily work. I am also going to install it using below command, then use it to install other necessary tools.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Use open source version of Git instead of Apple’s one

Second thing is to install latest version of Git on the machine. Here, I am also installing tcl-tk as Apple deprecated built-in version in macOS Catalina. By installing tcl-tk, you will able to use git gui and gitk in your macOS.

brew install git

brew install tcl-tk
brew link tcl-tk --force

Now, check your git version:

git --version

For my case: git version 2.24.1

Set Your Git Identity

Set your name and email in Git configuration.

git config --global user.name "Kamrul Hasan"
git config --global user.email mkhrussell@gmail.com

Set Visual Studio Code (VS Code) as your editor for Git

Before setting VS Code as default editor for Git, you have to install Shell Command for VS Code. Follow guide for how to launch VS Code from the command line.

After installing code, set this as git editor using:

git config --global core.editor 'code --new-window --wait'

Set VS Code as Merge Tool and Diff Tool for Git

git config --global merge.tool vscode
git config --global mergetool.vscode.cmd 'code --new-window --wait $MERGED'

git config --global diff.tool vscode
git config --global difftool.vscode.cmd 'code --new-window --wait --diff $LOCAL $REMOTE'

Check Git Config

Now, check all the configs:

git config --list --show-origin

Output should be like below:

file:/usr/local/etc/gitconfig   credential.helper=osxkeychain
file:/Users/kamrul/.gitconfig   user.name=Kamrul Hasan
file:/Users/kamrul/.gitconfig   user.email=mkhrussell@gmail.com
file:/Users/kamrul/.gitconfig   core.editor=code --new-window --wait
file:/Users/kamrul/.gitconfig   merge.tool=vscode
file:/Users/kamrul/.gitconfig   mergetool.vscode.cmd=code --new-window --wait $MERGED
file:/Users/kamrul/.gitconfig   diff.tool=vscode
file:/Users/kamrul/.gitconfig   difftool.vscode.cmd=code --new-window --wait --diff $LOCAL $REMOTE

Edit Global Git Config

You can also edit the Git config with your editor.

git config --global --edit

git-config-edit.png

Comments