Skip to content

macOS dev environment setup guide ๐Ÿ˜Ž

License

Notifications You must be signed in to change notification settings

marekciupak/macos-dev-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

61 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

macOS dev environment setup

Security

Hard disc encryption

Go to System Preferences > Security & Privacy > FileVault and make sure the FileVault is ON.

Firewall

Go to System Preferences > Security & Privacy > Firewall and make sure the Firewall is ON.

Require password after sleep

Go to System Preferences > Security & Privacy > General and set Require password after sleep or screen saver begins to immediately or 5 seconds.

More

Keyboard preferences

In System preferences > Keyboard:

  • Key Repeat > Fast (all the way to the right)
  • Delay Until Repeat > Short (all the way to the right)
  • Modifier Keys... > Caps Lock (โ‡ช) Key set to ^ Control

Apps

Web browsers

Chrome

Install: https://www.google.com/chrome/browser/desktop/index.html

Extensions I recommend

Mozilla Firefox

Install: https://www.mozilla.org/pl/firefox/new/

Extensions I recommend

Text editor

Install VS Code: https://code.visualstudio.com/

Configuration

Open VS Code and:

  • press Cmd + p, type > Shell Command: Install 'code' command in Path and press Enter,

  • press Cmd + p, type > Preferences: Open Settings (JSON), press Enter, and paste the following settings to settings.json:

    {
        "editor.rulers": [
            120
        ],
        "editor.tabSize": 2,
        "explorer.confirmDragAndDrop": false,
        "explorer.confirmDelete": false,
        "workbench.startupEditor": "newUntitledFile",
        "files.insertFinalNewline": true,
        "files.trimTrailingWhitespace": true,
        "files.trimFinalNewlines": true,
        "editor.autoClosingBrackets": "never",
        "editor.autoClosingOvertype": "never",
        "editor.autoClosingQuotes": "never",
        "terminal.integrated.fontFamily": "Meslo LG S DZ for Powerline",
    }

GPG Suite

https://gpgtools.org/#gpgsuite

Other useful apps

Terminal

iTerm2

Install iTerm2: https://www.iterm2.com/downloads.html

Software package manager

Install Homebrew:

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

And then, run:

brew analytics off

Basic tools

Install some useful packages:

brew install curl mc

Git

Install Git:

brew install git

Set you username and email in Git:

git config --global user.name "Mona Lisa"
git config --global user.email "email@example.com"

โš ๏ธ Don't forget to replace "Mona Lisa" and "email@example.com" with your own data.

Shell

Install Zsh and set it as a default shell:

brew install zsh zsh-completions
chsh -s /bin/zsh

โš ๏ธ Reopen terminal window now to load Zsh shell.

Install Oh My Zsh:

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

Make your terminal look pretty

Use Dark Background in iTerm2

  • Go to: iTerm2 > Preferences > Profiles > Colors
  • Use Color presets... menu to import and select downloaded Pastel (Dark Background) theme
cd $HOME
git clone https://github.com/powerline/fonts.git
./fonts/install.sh
rm -rf ~/fonts/

Set font in iTerm2

  • Go to: iTerm2 > Preferences > Profiles > Text > Font > Change Font
  • Select the font: Fixed Width > Meslo LG S DZ for Powerline > RegularForPowerline > 11

Edit ~/.zshrc file and update ZSH_THEME= to:

ZSH_THEME="agnoster"

Configure Zsh

Edit ~/.zshrc file and update plugins= to:

plugins=(git bundler rails)

๐ŸŽ“ List of all available plugins is here: https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins.

Edit ~/.zshrc file and the following lines at the end:

export EDITOR='vim'

DEFAULT_USER=`whoami`

HISTFILE=$HOME/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt APPEND_HISTORY           # append rather than overwrite history file.
setopt EXTENDED_HISTORY         # save timestamp and runtime information
setopt HIST_EXPIRE_DUPS_FIRST   # allow dups, but expire old ones when I hit HISTSIZE
setopt HIST_FIND_NO_DUPS        # don't find duplicates in history
setopt HIST_IGNORE_ALL_DUPS     # ignore duplicate commands regardless of commands in between
setopt HIST_IGNORE_DUPS         # ignore duplicate commands
setopt HIST_REDUCE_BLANKS       # leave blanks out
setopt HIST_SAVE_NO_DUPS        # don't save duplicates
setopt INC_APPEND_HISTORY       # write after each command
setopt SHARE_HISTORY            # share history between sessions

export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

# homebrew
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_NO_INSECURE_REDIRECT=1
export HOMEBREW_CASK_OPTS=--require-sha
Clear completions cache

If you see the following message when starting a new session in the terminal:

compdef: unknown command or service: rails

you can run:

rm ~/.zcompdump*

zsh-autosuggestions

Install zsh-autosuggestions:

git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

Edit ~/.zshrc file and add zsh-autosuggestions to plugins= list:

plugins=(.... zsh-autosuggestions)

Edit ~/.zshrc file and the following lines at the end:

# zsh-autosuggestions
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=30'

zsh-syntax-highlighting and zsh-history-substring-search

Install zsh-syntax-highlighting and zsh-history-substring-search:

brew install zsh-syntax-highlighting zsh-history-substring-search

Edit ~/.zshrc file and the following lines at the end:

# zsh-syntax-highlighting (must be the last plugin sourced)
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

# zsh-history-substring-search (must be sourced after zsh-syntax-highlighting)
source /usr/local/share/zsh-history-substring-search/zsh-history-substring-search.zsh
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down

Vim

Install Janus Vim Distribution:

curl -L https://bit.ly/janus-bootstrap | bash

Map jj to esc:

echo ':imap jj <Esc>' >> ~/.vimrc.before

exa

Install exa:

brew install exa

Edit ~/.zshrc file and the following lines at the end:

# exa
alias l="exa -l -a -a --git --time-style=long-iso --group-directories-first"

The Silver Searcher

Install The Silver Searcher:

brew install the_silver_searcher

RoR & web development

PostgreSQL

brew install postgresql
brew services start postgresql

Redis

brew install redis
brew services start redis

Version Manager with support for Ruby, Node.js, Elixir, Erlang, Python & more

Install asdf-vm:

brew install asdf
echo -e "\n. $(brew --prefix asdf)/asdf.sh" >> ~/.zshrc
echo -e "\n. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash" >> ~/.zshrc

Install multiple languages

# install last version of Ruby
asdf plugin-add ruby
asdf install ruby 2.7.0
asdf global ruby 2.7.0

# install last version of Erlang (required for Elixir)
brew install wxmac         # for building with wxWidgets (required to start observer or debugger)
asdf plugin-add erlang
asdf install erlang 22.2.8
asdf global erlang 22.2.8

# install last version of Elixir
asdf plugin-add elixir
asdf install elixir 1.10.2
asdf global elixir 1.10.2

# import the OpenPGP public keys to a dedicated keyring (to be able to check the authenticity of the package)
GNUPGHOME="${ASDF_DIR:-$HOME/.asdf}/keyrings/nodejs" bash -c 'mkdir -p "$GNUPGHOME" && chmod 0700 "$GNUPGHOME" && bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring'
# install last LTS version of Node JS
asdf plugin-add nodejs
asdf install nodejs 12.16.1
asdf global nodejs 12.16.1

# install last version of Python
asdf plugin-add python
asdf install python 3.8.1
asdf global python 3.8.1
pip install --upgrade pip

Updating versions in the future

# to display the list of available versions, update plugins and use `list-all`, ex:
asdf plugin-update --all
asdf list-all ruby

Sample config for rubocop gem

Check it here: .rubocop.yml.

Releases

No releases published

Packages

No packages published

Languages