Skip to content

striveforbest/macOS-dev-environment-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 

Repository files navigation

Configuring macOS for Development

This doc assumes you are doing a clean install of Homebrew on a clean install of macOS Ventura (13.3).

iTerm2

Xcode

Install Xcode from the App Store. Install Command Line Tools:

xcode-select --install

Homebrew

Install:

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

Before we get around to setting up Z Shell, add Homebrew to PATH:

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

Git

Install:

brew install git

Set up new public SSH key (or restore existing):

mkdir -p ~/.ssh && cd ~/.ssh
ssh-keygen -t rsa -b 4096 -C "[email protected]"
pbcopy < ~/.ssh/id_rsa.pub

After installation, follow the instructions to set up commit signing.

You'll need pinentry:

brew install pinentry-mac

Set global git settings (or restore from Dotfiles repository:

git config --global user.name "Alex Zagoro"
git config --global user.email "[email protected]"
git config --global color.ui true

Now, you can add your old-style SSH key as a subkey to GPG.

First, export your public key from id_rsa private key (you might be able to skip it if you already have pubkey):

ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub

Then, convert id_rsa.pub public key to the OpenPGP format:

gpg --export-options export-minimal --export OpenPGP ~/.ssh/id_rsa.pub > ~/.ssh/id_rsa_opengpg.pub

Import it into your GPG keyring:

gpg --import ~/.ssh/id_rsa_opengpg.pub

Associate the subkey with your GPG key.

First, obtain the Key ID:

gpg --list-keys

Look for the line that starts with "pub" and contains your key's email address. The Key ID is the 8-character hexadecimal code next to the email address.

Once you have the Key ID, add the subkey to your GPG key:

gpg --edit-key <Key ID>

Inside the GPG key editing interface, enter the following command to add the subkey:

addkey

Select the option for "RSA (sign only)" or "RSA (encrypt only)," depending on the purpose of the subkey. Follow the prompts to enter a passphrase (optional) and complete the subkey creation process.

After the subkey is added, use the following command to save the changes and exit the GPG key editing interface:

save

That's it! You have successfully added your old id_rsa key as a subkey to your GPG key. You can verify the addition by listing your GPG keys:

gpg --list-keys

cURL/wget

Install:

brew install curl wget

Z shell

Mac OS Ventura+ has zsh preinstalled, but you should install some plugins:

brew install zsh-completions zsh-autosuggestions zsh-syntax-highlighting

Output:

==> Caveats
To activate the syntax highlighting, add the following at the end of your .zshrc:
  source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

If you receive "highlighters directory not found" error message,
you may need to add the following to your .zshenv:
  export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/opt/homebrew/share/zsh-syntax-highlighting/highlighters
==> Summary
🍺  /opt/homebrew/Cellar/zsh-syntax-highlighting/0.7.1: 27 files, 164.7KB
==> Running `brew cleanup zsh-syntax-highlighting`...
==> Caveats
==> zsh-completions
To activate these completions, add the following to your .zshrc:

  if type brew &>/dev/null; then
    FPATH=$(brew --prefix)/share/zsh-completions:$FPATH

    autoload -Uz compinit
    compinit
  fi

You may also need to force rebuild `zcompdump`:

  rm -f ~/.zcompdump; compinit

Additionally, if you receive "zsh compinit: insecure directories" warnings when attempting
to load these completions, you may need to run this:

  chmod -R go-w '/opt/homebrew/share/zsh'
==> zsh-autosuggestions
To activate the autosuggestions, add the following at the end of your .zshrc:

  source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh

You will also need to restart your terminal for this change to take effect.
==> zsh-syntax-highlighting
To activate the syntax highlighting, add the following at the end of your .zshrc:
  source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

If you receive "highlighters directory not found" error message,
you may need to add the following to your .zshenv:
  export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/opt/homebrew/share/zsh-syntax-highlighting/highlighters

Update default shell:

chsh -s $(which zsh)

Oh My Zsh

Oh My Zsh is an open source, community-driven framework for managing your zsh configuration. Instructions

Install:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

powerlevel9k

Oh My Zsh theme. Instructions

Install:

$ git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k

Install powerline fonts:

git clone [email protected]:powerline/fonts.git  ~/.oh-my-zsh/custom/fonts
cd ~/.oh-my-zsh/custom/fonts
./install.sh

Keep in mind, you'll need to set the fonts in your iTerm Settings -> Profiles -> Text -> Change Font -> Meslo LG S DZ Regular for Powerline.

Dot files

Files are available in Dotfiles repository:

cd
ln -s <PATH>/dotfiles/.zshrc
ln -s <PATH>/dotfiles/.profile
ln -s <PATH>/dotfiles/.aliases
ln -s <PATH>/dotfiles/.functions
ln -s <PATH>/dotfiles/bin
ln -s <PATH>/dotfiles/.gitignore_global
ln -s <PATH>/dotfiles/.gitconfig
source ~/.zshrc

Set up GPG config:
mkdir -p ~/.gnupg
ln -s <PATH>/dotfiles/.gnupg/gpg-agent.conf ~/.gnupg/.

AWS CLI

Install CLI and add profiles/credentials:

brew install awscli s3cmd

Create ~/.aws/config and ~/.aws/credentials and set them up.

Programming Languages

Python

Install pyenv first:

brew install pyenv pyenv-virtualenv pyenv-virtualenvwrapper

Now, you can install multiple Python versions via:

pyenv install 3.11

Frontend Tools

Install NVM first:

brew install nvm
Which now allows you to install multiple node/npm versions::
nvm install 14.15.0 nvm use 14.15.0

Npm-X (makes commands from local environment available):

npm install npx -g

Data Stores

PostgreSQL

Just download and install Postgres.app from https://postgresapp.com/ (which comes with Postgis)

Enable CLI:

sudo mkdir -p /etc/paths.d && echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp

Redis

Install:

brew install redis

Output:

==> Caveats
To start redis now and restart at login:
    brew services start redis
Or, if you don't want/need a background service you can just run:
    /opt/homebrew/opt/redis/bin/redis-server /opt/homebrew/etc/redis.conf

ElasticSearch

Install:

brew install elasticsearch

Run in on system start:

brew services start elasticsearch

Miscellaneous tools

Zlib:

brew install zlib

OpenSSL:

brew install openssl

JQ:

brew install jq

Vault:

brew install vault

Htop:

brew install htop

Cheat:

brew install cheat
# Usage
cheat -l
cheat tar

Fortune:

brew install fortune

Image processing utils

Install for full support of PIL/Pillow:

brew install imagemagick
brew install freetype graphicsmagick jpegoptim lcms libjpeg libpng libtiff openjpeg optipng pngcrush webp

Video processing utils

FFmpeg:

brew install ffmpeg

To see a full list of FFmpeg options:

brew options ffmpeg

Homebrew maintenance

Get a checkup from the doctor and follow the doctor's instructions:

brew doctor

To update your installed brews:

brew update
brew outdated
brew upgrade
brew cleanup

OS-specific settings

Allow opening apps from unidentified developers:

sudo spctl --master-disable

About

Instructions to set up an OSX machine for web development.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published