Skip to content

Instantly share code, notes, and snippets.

@nicolasrouanne
Last active December 16, 2022 15:08
Show Gist options
  • Save nicolasrouanne/6ee99a41d5c7654f606e4a93aeb336f1 to your computer and use it in GitHub Desktop.
Save nicolasrouanne/6ee99a41d5c7654f606e4a93aeb336f1 to your computer and use it in GitHub Desktop.
Git and Shell configuration on my local MacOS machine

Git Completion by Git

Add the git-completion feature by copying the original .git-completion.bash from the official Git repository to your system.

Git Prompt by Git

Add the git-prompt feature by copying the original .git-prompt.sh from the official Git repository to your system.

[core]
editor = nano
excludesfile = ~/.gitignore_global
[user]
name = Nicolas Rouanne
email = nico.rouanne@gmail.com
signingkey = EFB02CA2C65936A9
[credential]
helper = osxkeychain
[alias]
st = status
co = checkout
br = branch -v
sweep = "!git branch --merged | egrep -v '(\\*|master)' | xargs -n 1 git branch -d"
[push]
default = current
[pull]
ff = only
[fetch]
prune = true
[commit]
gpgsign = true
[gpg]
program = /opt/homebrew/bin/gpg
# Source: https://gist.github.com/octocat/9257657
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
*.sql
*.sqlite
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# IDEs #
########
.vscode
.idea

Set up a new Mac

Install the Xcode Tools

When trying to run a command such as git, your Mac will tell you Xcode tools are not installed yet. A pop up dialog will display, you just have to click on 'Install'.

Or if you prefer, you can run:

$ xcode-select --install

Configure git

Create a .gitconfig file in your home directory with the content in this Gist

Copy and paste the files .git-prompt.sh and .git-completion.bash from this Gist into your home directory.

Add a global .gitignore to your home directory, following Github's advice. This Gist has an example in file .gitignore_global.

Configure your terminal

Add aliases, autocompletion and so on. This is done by creating a .bash_profile file at your home directory. Take the example in this gist.

# in your home directory
$ nano .bash_profile
# paste all the content of the file, save and quit

Select the Pro skin with 93% of opacity 🎨. The nice colors of prompt and so forth are already added by the .bash_profile settings.

Install all the dependencies for your terminal

When starting up a terminal session, it will load the .bash_profile which has instructions to try and load some environment variable, libraries and such. If you don't install these libraries, an error message will be displayed.

Install Brew

Brew is a package and dependency manager for Mac OS. It is used to install most of the CLI libraries and tools on Mac OS.

To install:

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

Install pyenv

Install(https://github.com/pyenv/pyenv#homebrew-on-mac-os-x) pyenv with Brew. pyenv is a Python version management system.

$ brew install pyenv

Install Rbenv

Install rbenv which will be automatically loaded from your ~/.bash_profile and will throw an error otherwise.

rbenv is used to manage ruby versions. Especially useful when developing on Rails or Ruby Gems.

$ brew install rbenv

Install yarn

yarn is a package manager for Node.

$ brew install yarn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment