Skip to content

chatwoot/macbook-setup-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Mac setup guide

This guide enlists common steps to set up your macbook for the day to day local development.

Setting up macOS

Enable Rosetta for Terminal on M1 Mac

Rosetta 2 is the lifeline that allows you to run apps designed for Intel-based chips that use x86 architecture on ARM-based chips (in this case M1). This solution is provided by Apple in form of an emulator and doesn't come pre-installed. You have to install it manually. Fire up the Terminal application that comes pre-installed on the Big Sur and let your first command to execute be:

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

Install Homebrew package manager

Run following command in terminal

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then create .zshrc on home directory (If it was not created yet). Just run on terminal:

touch .zshrc

Then open it to edit with TextEdit (Is a hidden file. You can show hidden files with shift + command + . )

Add this line at the end of .zshrc

export PATH=/opt/homebrew/bin:$PATH

Run this command in terminal to make this available:

source ~/.zshrc

Now just run this command to be sure that everything is working:

brew help

Make sure everything is up to date.

brew update

NOTE: DO NOT use Homebrew to install node or ruby package.

Install iterm2

brew install --cask iterm2

Make ZSH as default shell

Before going forward, please make sure zsh is your default terminal shell.

You can run echo $SHELL to see what's the current shell.

If it's not your default shell, then set it up manually:

chsh -s $(which zsh)

Install oh-my-zsh

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

Install VS Code

brew install --cask visual-studio-code

Install Apps and Developer tools

Installing Node

We recommend to use nvm to install Node.js. This allows you to easily switch between Node versions, which is essential.

Installing nvm

https://github.com/nvm-sh/nvm#install--update-script

Install a latest node version

nvm install node

Install a specific node version using nvm

To install, say node 8.14.0, run

nvm install 8.14.0

Useful nvm commands

If you want to see what node versions are installed

nvm ls

To use a different node version, say 12.6.0 as the default node version everywhere

nvm alias default 12.6.0

To use a different node version for the current directory

nvm use 10.16.0

Update nvm

For later, here's how to update nvm.

nvm install node --reinstall-packages-from=node

Installing Postgres

 brew install postgresql
 brew services start postgresql

The installation procedure created a user account called postgres that is associated with the default Postgres role. In order to use Postgres, you can log into that account.

sudo -u postgres psql

Installing Redis

 brew install redis
 brew services start redis

Configuring Git

The first thing you should do with Git is set your global configuration

touch ~/.gitconfig

Input your config and create some aliases

[alias]
  a      = add
  ca     = commit -a
  cam    = commit -am
  cm     = commit -m
  s      = status
  p      = push
  pom    = push origin master
  puom   = pull origin master
  cob    = checkout -b
  co     = checkout
  fp     = fetch --prune --all
  l      = log --oneline --decorate --graph
  lall   = log --oneline --decorate --graph --all
  ls     = log --oneline --decorate --graph --stat
  lt     = log --graph --decorate --pretty=format:'%C(yellow)%h%Creset%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)%an%Creset'

With the above aliases, I can run git a instead of git add, for example. The less I have to type, the happier I am.

Configure your name and email to help Git to set the author of the commits you will add onwards.

git config --global user.name "Your Name Here" # e.g. John Doe
git config --global user.email "your.email@chatwoot.com"

Installing Ruby

We recommend to use rbenv to manage versions of Ruby.

Installing rbenv

brew install rbenv

Ensure that rbenv is installed successfully by checking whether the rbenv -v command prints rbenv version or not. If not installed, install it using brew install rbenv command.

Set up rbenv in your shell.

rbenv init

If you are using zsh shell then use the following command:

echo 'eval "$(rbenv init -)"' >> ~/.zshrc

Add ~/.rbenv/bin to your $PATH for accessing the rbenv command-line utility.

If you are using zsh shell then use the following command:

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc

Installing a Ruby version using rbenv

To install, say Ruby 2.5.3, run

rbenv install 2.5.3

Useful rbenv commands

To check the current Ruby version

rbenv version

To list all installed Ruby versions

rbenv versions

To set a different Ruby version for the current directory

rbenv local 1.9.3-p327

Now install bundler which help us manage Ruby gems:

gem install bundler

Installing yarn

Install it:

brew install yarn

References

Releases

No releases published

Packages

 
 
 

Languages