Skip to content

Instantly share code, notes, and snippets.

@ffscalco
Last active January 17, 2022 04:29
Show Gist options
  • Save ffscalco/74f110e969274fea887a24a65d1e2570 to your computer and use it in GitHub Desktop.
Save ffscalco/74f110e969274fea887a24a65d1e2570 to your computer and use it in GitHub Desktop.
Useful information to setup a fresh macos

Applications

https://macapps.link/en/

Homebrew

Open the terminal and paste the following code:

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

Iterm + zsh + oh-my-zsh

Open the terminal and install the iterm2 first:

brew install iterm2

Open iterm2 and then install zsh using homebrew:

brew install zsh

Paste the following code to instal oh-my-zsh:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

If you see some messages about the user/permissions, go to the folder /usr/share and run compaudit | xargs chmod g-w,o-w

Fonts and iterm styles

I personaly like the Roboto Mono font in the text editors and in the terminal https://fonts.google.com/specimen/Roboto+Mono?preview.text_type=custom

This is the preset colours I like to use with iterm https://draculatheme.com/iterm

Open the terminal and install the gpg package:

brew install gpg

Install the GPG keys:

gpg --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Install the rvm using the curl command:

\curl -sSL https://get.rvm.io | bash -s stable

To install ruby versions, run the following command (change the required version):

rvm instal ruby-3.0.0

Install nvm with homebrew:

brew install nvm

Create a directory for nvm

mkdir ~/.nvm

Add these 2 lines in your ~/.zshrc and restart the terminal.

export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh

To intall node versions, use the following command:

nvm install 14

The command above will install the node version 14

Show current ruby version and gemset in the terminal

Paste this code in your .zshrc file (after the source $ZSH/oh-my-zsh.sh)

function prompt_rvm {
    rbv=`rvm-prompt`
    rbv=${rbv#ruby-}
    [[ $rbv == *"@"* ]] || rbv="${rbv}@default"
    echo $rbv
}
RPROMPT="%{$fg[yellow]%}\$(prompt_rvm s i v g) %{$fg[white]%}"

Install MySQL 5.7

Follow this gist: https://gist.github.com/wpconsulate/40469bfdafad9fdd0afc3e260a5586a7

Install Postgres 12

brew install postgresql@12

Start the service

brew services start postgresql@12

If you need to have postgresql@12 first in your PATH, add the following in your .zshrc file:

export PATH="/usr/local/opt/postgresql@12/bin:$PATH

For compilers to find postgresql@12 you may need to add:

export LDFLAGS="-L/usr/local/opt/postgresql@12/lib"
export CPPFLAGS="-I/usr/local/opt/postgresql@12/include"

For pkg-config to find postgresql@12 you may need to set:

export PKG_CONFIG_PATH="/usr/local/opt/postgresql@12/lib/pkgconfig"

Install a better interactive process viewer - htop

brew install htop

Install DBeaver (Universal Database tool)

brew install dbeaver-community

Install Redis

brew install redis

Then to start the service: brew services start redis

Launch Redis on computer starts

ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents

Start Redis server via “launchctl”

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

Test if Redis server is running

redis-cli ping

It must return with PONG

Install Heroku CLI

brew tap heroku/brew && brew install heroku

@duderamos
Copy link

duderamos commented Mar 30, 2021

For databases in Docker:

Run Docker in swarm mode: docker swarm init

Create persistent volumes for the containers:

for i in pgsql mongodb mysql; do docker volume create $i ; done

Create a docker-compose.yml file with:

version: '3.3'
services:
  pgsql:
    image: postgres:10.4
    ports:
      - "5432:5432"
    volumes:
      - "pgsql:/var/lib/postgresql/data"
  mongodb:
    image: mongo
    ports:
      - "27017:27017"
    volumes:
      - 'mongodb:/data/db'
    networks:
      - default
  redis:
    image: redis
    ports:
      - "6379:6379"
  memcached:
    image: memcached
    ports:
      - "11211:11211"
  mysql:
    image: mysql
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
    ports:
      - "33060:33060"
      - "3306:3306"
    volumes:
      - 'mysql:/var/lib/mysql'
volumes:
  mongodb:
    external: true
  mysql:
    external: true
  pgsql:
    external: true
networks:
  default:

Deploy your stack: docker stack deploy -c docker-file.yml fabiano

Check for services running: docker service ls

Scale up and down services: docker service scale fabiano_mysql=1 fabiano_pgsql=0

This way you don't need to install databases in your system and can run multiple versions at the same time.

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