Skip to content

Instantly share code, notes, and snippets.

@jagdeepsingh
Last active September 21, 2023 11:57
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jagdeepsingh/de13ae49b52487550b379d1cda6869f7 to your computer and use it in GitHub Desktop.
Save jagdeepsingh/de13ae49b52487550b379d1cda6869f7 to your computer and use it in GitHub Desktop.
Set up macOS High Sierra 10.13.6

Set up macOS High Sierra 10.13.6

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

$ git --version
git version 2.15.2 (Apple Git-101.1)

Configure the username and email to be used.

$ git config --global user.name jagdeepsingh
$ git config --global user.email jagdeepsingh.125k@gmail.com

Generate SSH key. When prompted to select file location and to enter passphrase, leave it empty.

$ ssh-keygen -t rsa -b 4096 -C 'jagdeepsingh.125k@gmail.com'
Generating public/private rsa key pair.
...
Your public key has been saved in /path/to/home/.ssh/id_rsa.pub.

Copy the contents of file ~/.ssh/id_rsa.pub and add it to "SSH Keys" under "Github > Settings > SSH and GPG Keys".

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Enter your mac password when prompted.

$ brew -v
Homebrew 1.7.1
Homebrew/homebrew-core (git revision bda6; last commit 2018-08-13)
$ brew install rbenv

$ rbenv -v
rbenv 1.1.1

$ rbenv init
# You will find a list of intructions here. Follow them to set up rbenv shell integration.

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 20180618)
Counting installed Ruby versions: none
  There aren't any Ruby versions installed under `/path/to/home/.rbenv/versions'.
  You can install Ruby versions like so: rbenv install 2.2.4
Checking RubyGems settings: OK
Auditing installed plugins: OK

Install atom and then install shell commands like atom by clicking on "Atom > Install Shell Commands".

5 ruby

$ rbenv install 2.1.3

Check the installed versions.

$ rbenv versions
* system (set by /path/to/home/.rbenv/version)
  2.1.3

Use a specific version.

$ rbenv local 2.1.3

Check the current active version.

$ rbenv version
2.1.3

See full cheatsheet here.

6 bundler

$ gem install bundler

$ bundler -v
Bundler version 1.16.3

7 Heroku CLI

$ brew update
$ brew install heroku
$ heroku -v
heroku-cli/5.6.28-2643c0a (darwin-amd64) go1.7.5

$ heroku login
# Follow prompt and input email and password.
Logged in as jagdeepsingh.125k@gmail.com

$ cd tournament-planner
$ heroku git:remote -a tournament-planner
set git remote heroku to https://git.heroku.com/tournament-planner.git

$ git remote -v
...
heroku	https://git.heroku.com/tournament-planner.git (fetch)
heroku	https://git.heroku.com/tournament-planner.git (push)
...

$ git push heroku master

$ heroku pg:reset
$ heroku run rake db:migrate
$ heroku run rake db:seed
$ heroku run rake db:version
Current version: 20170302103641

7.1 Import local database to Heroku

Create secret keys in Securiy Credentials section on AWS.

$ heroku config:set AWS_ACCESS_KEY_ID=<access-key> AWS_SECRET_ACCESS_KEY=<secret-access-key>

Create a bucket here.

$ heroku config:set S3_BUCKET_NAME=tournament-planner-assets

Take database dump on local.

$ pg_dump -Fc --no-acl --no-owner -h localhost tournament-planner_development > tournament-planner_production.dump

Upload the dump file on AWS S3 and note the public url for the file.

Import the database dump now.

$ heroku pg:reset DATABASE_URL
 ▸    WARNING: Destructive action
 ▸    postgresql-adjacent-10075 will lose all of its data
...

$ heroku pg:backups:restore <public-url-for-dump-file> 'postgresql-adjacent-10075'

7.2 Database backups

See all backups.

$ heroku pg:backups

Create a backup manually.

$ heroku pg:backups:capture

Schedule a backup daily.

$ heroku pg:backups:schedule postgresql-adjacent-10075 --at '04:00 America/Los_Angeles'

Here postgresql-adjacent-10075 is the DATABASE_URL.

See all schedules.

$ heroku pg:backups:schedules

7.3 Export a database dump to local

$ heroku pg:backups:download
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -d database_name latest.dump

7.4 See logs

$ heroku logs -t
@ajmerphull
Copy link

This repo no longer available because i get a 404 when following the curl request. i had to rebuild my HDD and i had Homebrew on my previous version of OS but now i can't install Homebrew on 10.13

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