Skip to content

Instantly share code, notes, and snippets.

@jagdeepsingh
Last active September 22, 2021 15:28
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jagdeepsingh/5aca593ea926b79bfe135303e36dbc8b to your computer and use it in GitHub Desktop.
Save jagdeepsingh/5aca593ea926b79bfe135303e36dbc8b to your computer and use it in GitHub Desktop.
Set up macOS Big Sur 11.2 with development tools | Git | Homebrew | rbenv | ruby | Atom | PostgreSQL | mongodb

Set up macOS Big Sur 11.2

Contents:

1 git

1.1 Install

Open the terminal and type git. If it not already installed, you will see a dialog box with a button to "Install" it. Click on it and git will be installed in a couple of minutes.

% git --version
git version 2.24.3 (Apple Git-128)

1.2 Configure

Configure the username and email to be used for git.

% git config --global user.name jagdeepsingh
% git config --global user.email jagdeepsingh.125k@gmail.com
% ssh-keygen -t ed25519 -C "jagdeepsingh.125k@gmail.com"
Generating public/private ed25519 key pair.
...
Your identification has been saved in /Users/jagdeepsingh/.ssh/id_ed25519.
Your public key has been saved in /Users/jagdeepsingh/.ssh/id_ed25519.pub.
...
# Start the ssh-agent in the background
% eval "$(ssh-agent -s)"
Agent pid 744

# Create the config file, if it doesn't exist
% touch ~/.ssh/config

# Open the file and add following contents to it
Host *
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_ed25519

NOTE: If you chose to add a passphrase to your key in previous steps, please visit above doc to check the contents for ~/.ssh/config.

# Add your SSH private key to the ssh-agent
% ssh-add ~/.ssh/id_ed25519
Identity added: /Users/jagdeepsingh/.ssh/id_ed25519 (jagdeepsingh.125k@gmail.com)

Again, if you chose to add a passphrase to your key in previous steps, please refer the docs.

Copy the SSH public key to your clipboard.

% pbcopy < ~/.ssh/id_ed25519.pub

Add it to "SSH Keys" under "Settings > SSH and GPG Keys". When copying your key, don't add any newlines.

% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Enter your MacBook password when prompted.

% brew -v
Homebrew 3.0.0
Homebrew/homebrew-core (git revision d6c297; last commit 2021-02-11)
% brew install rbenv

% brew upgrade rbenv ruby-build
Updating Homebrew...
Warning: rbenv 1.1.2 already installed
Warning: ruby-build 20210119 already installed

% rbenv -v
rbenv 1.1.2

Set up rbenv in your shell.

% rbenv init
# Follow the printed instructions generated by this command.

Close your terminal window and open a new one for changes to take effect.

Verify that rbenv is properly set up by running:

% curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
Checking for `rbenv' in PATH: /usr/local/bin/rbenv
Checking for rbenv shims in PATH: OK
Checking `rbenv install' support: /usr/local/bin/rbenv-install (ruby-build 20210119)
Counting installed Ruby versions: none
  There aren't any Ruby versions installed under `/Users/jagdeepsingh/.rbenv/versions'.
  You can install Ruby versions like so: rbenv install 2.2.4
Checking RubyGems settings: OK
Auditing installed plugins: OK
% rbenv install 2.6.6

Check the installed ruby versions.

% rbenv versions
  system
* 2.6.6

Check the current active version.

% rbenv version
2.6.6

Use a specific version.

% rbenv local 2.6.6

Test the installation success by running irb in terminal.

Optionally, update the rubygems.

% rbenv global 2.6.6
% rbenv rehash

# Close the terminal and open again
% gem update --system

See full rbenv cheetsheet for more commands.

Download and Install "Atom", and then Move it into "Applications" folder.

Open "Atom" and install shell commands (e.g. atom) by clicking on "Atom > Install Shell Commands".

6 Databases

% brew install postgresql

% postgres --version
postgres (PostgreSQL) 13.1

To have launchd start postgresql now and restart at login:

% brew services start postgresql

Create role "postgres" by running:

% /usr/local/opt/postgres/bin/createuser -s postgres

Login to the server. Reference

% psql postgres
psql (13.1)
Type "help" for help.

postgres=#

You can run your PostgreSQL queries here.

% brew tap mongodb/brew

% brew install mongodb-community

To have launchd start mongodb/brew/mongodb-community now and restart at login:

% brew services start mongodb/brew/mongodb-community

Test the installation success by running mongo in terminal.

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