| description | Essential tools to have |
|---|
Install the command line developer tools
$ xcode-select --install
macOS doesn't come with a package manager, our best option is to install Homebrew
The Missing Package Manager for macOS
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install git
$ git config --global user.name "João Barreiros"
$ git config --global user.email "unstablectrl@gmail.com"
$ git config --global init.defaultBranch "main"
$ git config --global core.editor "code"
$ mkdir ~/.gpg
$ touch ~/.gpg/private.key
Paste private key inside the newly created private.key file
$ brew install gpg
$ gpg --import ~/.gpg/private.key
Change the key trust
$ gpg --edit-key <keyname>
gpg> trust
Please decide how far you trust this user to correctly verify other users' keys
(by looking at passports, checking fingerprints from different sources, etc.)
1 = I don't know or won't say
2 = I do NOT trust
3 = I trust marginally
4 = I trust fully
5 = I trust ultimately
m = back to the main menu
Your decision? 5
Do you really want to set this key to ultimate trust? (y/N) y
gpg> save
gpg> quit
Set your GPG signing key in Git
$ git config --global user.signingkey "${$(gpg --list-keys --keyid-format=long | awk '/pub/{if (length($2) > 0) print $2}')##*/}"
$ gpg --armor --export "${$(gpg --list-keys --keyid-format=long | awk '/pub/{if (length($2) > 0) print $2}')##*/}"
To be able to sign using Visual Studio Code
$ brew install pinentry-mac
$ echo "pinentry-program /opt/homebrew/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf
Uncertain if this is needed
$ git config --global --add gpg.program $(which gpg)
$ brew tap heroku/brew
$ brew install heroku