├── .gitignore └── README.rst /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/* -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | ================================= 2 | Configuring macOS for Development 3 | ================================= 4 | 5 | This doc assumes you are doing a clean install of `Homebrew `_ on a clean install of macOS Ventura (13.3). 6 | 7 | iTerm2 8 | ^^^^^^ 9 | - `Download `_ and install iTerm2. 10 | 11 | - Set up `Shell Integration `_ and set up the shortcuts. 12 | 13 | 14 | Xcode 15 | ^^^^^ 16 | 17 | Install Xcode from the App Store. 18 | Install Command Line Tools:: 19 | 20 | xcode-select --install 21 | 22 | Homebrew 23 | ^^^^^^^^ 24 | 25 | Install:: 26 | 27 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 28 | brew doctor 29 | 30 | Before we get around to setting up Z Shell, add Homebrew to PATH:: 31 | 32 | export PATH=/opt/homebrew/bin:$PATH 33 | 34 | Git 35 | ^^^ 36 | 37 | Install:: 38 | 39 | brew install git 40 | 41 | Set up new public SSH key (or restore existing):: 42 | 43 | mkdir -p ~/.ssh && cd ~/.ssh 44 | ssh-keygen -t rsa -b 4096 -C "alex@eagerminds.co" 45 | pbcopy < ~/.ssh/id_rsa.pub 46 | 47 | `GPG Suite `_ 48 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 49 | 50 | After installation, follow the instructions to `set up commit signing `_. 51 | 52 | You'll need `pinentry`:: 53 | 54 | brew install pinentry-mac 55 | 56 | 57 | Set global git settings (or restore from `Dotfiles repository `_:: 58 | 59 | git config --global user.name "Alex Zagoro" 60 | git config --global user.email "alex@eagerminds.co" 61 | git config --global color.ui true 62 | 63 | Now, you can add your old-style SSH key as a subkey to GPG. 64 | 65 | First, export your public key from `id_rsa` private key (you might be able to skip it if you already have pubkey):: 66 | 67 | ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub 68 | 69 | Then, convert `id_rsa.pub` public key to the OpenPGP format:: 70 | 71 | gpg --export-options export-minimal --export OpenPGP ~/.ssh/id_rsa.pub > ~/.ssh/id_rsa_opengpg.pub 72 | 73 | Import it into your GPG keyring:: 74 | 75 | gpg --import ~/.ssh/id_rsa_opengpg.pub 76 | 77 | Associate the subkey with your GPG key. 78 | 79 | First, obtain the Key ID:: 80 | 81 | gpg --list-keys 82 | 83 | Look for the line that starts with "pub" and contains your key's email address. 84 | The Key ID is the 8-character hexadecimal code next to the email address. 85 | 86 | Once you have the Key ID, add the subkey to your GPG key:: 87 | 88 | gpg --edit-key 89 | 90 | Inside the GPG key editing interface, enter the following command to add the subkey:: 91 | 92 | addkey 93 | 94 | Select the option for "RSA (sign only)" or "RSA (encrypt only)," depending on the purpose of the subkey. 95 | Follow the prompts to enter a passphrase (optional) and complete the subkey creation process. 96 | 97 | After the subkey is added, use the following command to save the changes and exit the GPG key editing interface:: 98 | 99 | save 100 | 101 | That's it! You have successfully added your old id_rsa key as a subkey to your GPG key. 102 | You can verify the addition by listing your GPG keys:: 103 | 104 | gpg --list-keys 105 | 106 | cURL/wget 107 | ^^^^^^^^^ 108 | 109 | Install:: 110 | 111 | brew install curl wget 112 | 113 | Z shell 114 | ^^^^^^^ 115 | 116 | Mac OS Ventura+ has zsh preinstalled, but you should install some plugins:: 117 | 118 | brew install zsh-completions zsh-autosuggestions zsh-syntax-highlighting 119 | 120 | Output:: 121 | 122 | ==> Caveats 123 | To activate the syntax highlighting, add the following at the end of your .zshrc: 124 | source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 125 | 126 | If you receive "highlighters directory not found" error message, 127 | you may need to add the following to your .zshenv: 128 | export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/opt/homebrew/share/zsh-syntax-highlighting/highlighters 129 | ==> Summary 130 | 🍺 /opt/homebrew/Cellar/zsh-syntax-highlighting/0.7.1: 27 files, 164.7KB 131 | ==> Running `brew cleanup zsh-syntax-highlighting`... 132 | ==> Caveats 133 | ==> zsh-completions 134 | To activate these completions, add the following to your .zshrc: 135 | 136 | if type brew &>/dev/null; then 137 | FPATH=$(brew --prefix)/share/zsh-completions:$FPATH 138 | 139 | autoload -Uz compinit 140 | compinit 141 | fi 142 | 143 | You may also need to force rebuild `zcompdump`: 144 | 145 | rm -f ~/.zcompdump; compinit 146 | 147 | Additionally, if you receive "zsh compinit: insecure directories" warnings when attempting 148 | to load these completions, you may need to run this: 149 | 150 | chmod -R go-w '/opt/homebrew/share/zsh' 151 | ==> zsh-autosuggestions 152 | To activate the autosuggestions, add the following at the end of your .zshrc: 153 | 154 | source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh 155 | 156 | You will also need to restart your terminal for this change to take effect. 157 | ==> zsh-syntax-highlighting 158 | To activate the syntax highlighting, add the following at the end of your .zshrc: 159 | source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 160 | 161 | If you receive "highlighters directory not found" error message, 162 | you may need to add the following to your .zshenv: 163 | export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/opt/homebrew/share/zsh-syntax-highlighting/highlighters 164 | 165 | Update default shell:: 166 | 167 | chsh -s $(which zsh) 168 | 169 | Oh My Zsh 170 | ^^^^^^^^^ 171 | 172 | Oh My Zsh is an open source, community-driven framework for managing your zsh configuration. `Instructions `_ 173 | 174 | Install:: 175 | 176 | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" 177 | 178 | powerlevel9k 179 | ^^^^^^^^^^^^ 180 | 181 | Oh My Zsh theme. `Instructions `_ 182 | 183 | Install:: 184 | 185 | $ git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k 186 | 187 | Install powerline `fonts `_:: 188 | 189 | git clone git@github.com:powerline/fonts.git ~/.oh-my-zsh/custom/fonts 190 | cd ~/.oh-my-zsh/custom/fonts 191 | ./install.sh 192 | 193 | 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. 194 | 195 | Dot files 196 | ========= 197 | 198 | Files are available in `Dotfiles repository `_:: 199 | 200 | cd 201 | ln -s /dotfiles/.zshrc 202 | ln -s /dotfiles/.profile 203 | ln -s /dotfiles/.aliases 204 | ln -s /dotfiles/.functions 205 | ln -s /dotfiles/bin 206 | ln -s /dotfiles/.gitignore_global 207 | ln -s /dotfiles/.gitconfig 208 | source ~/.zshrc 209 | 210 | Set up GPG config: 211 | mkdir -p ~/.gnupg 212 | ln -s /dotfiles/.gnupg/gpg-agent.conf ~/.gnupg/. 213 | 214 | AWS CLI 215 | ^^^^^^^ 216 | 217 | Install CLI and add profiles/credentials:: 218 | 219 | brew install awscli s3cmd 220 | 221 | Create `~/.aws/config` and `~/.aws/credentials` and set them up. 222 | 223 | Programming Languages 224 | ===================== 225 | 226 | Python 227 | ^^^^^^ 228 | 229 | Install pyenv first:: 230 | 231 | brew install pyenv pyenv-virtualenv pyenv-virtualenvwrapper 232 | 233 | Now, you can install multiple Python versions via:: 234 | 235 | pyenv install 3.11 236 | 237 | Frontend Tools 238 | ============== 239 | 240 | Install NVM first:: 241 | 242 | brew install nvm 243 | 244 | Which now allows you to install multiple node/npm versions:: 245 | nvm install 14.15.0 246 | nvm use 14.15.0 247 | 248 | Npm-X (makes commands from local environment available):: 249 | 250 | npm install npx -g 251 | 252 | 253 | Data Stores 254 | =========== 255 | 256 | PostgreSQL 257 | ^^^^^^^^^^ 258 | 259 | Just download and install Postgres.app from https://postgresapp.com/ (which comes with Postgis) 260 | 261 | Enable CLI:: 262 | 263 | sudo mkdir -p /etc/paths.d && echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp 264 | 265 | Redis 266 | ^^^^^ 267 | 268 | Install:: 269 | 270 | brew install redis 271 | 272 | Output:: 273 | 274 | ==> Caveats 275 | To start redis now and restart at login: 276 | brew services start redis 277 | Or, if you don't want/need a background service you can just run: 278 | /opt/homebrew/opt/redis/bin/redis-server /opt/homebrew/etc/redis.conf 279 | 280 | 281 | ElasticSearch 282 | ^^^^^^^^^^^^^ 283 | 284 | Install:: 285 | 286 | brew install elasticsearch 287 | 288 | Run in on system start:: 289 | 290 | brew services start elasticsearch 291 | 292 | 293 | Miscellaneous tools 294 | =================== 295 | 296 | `Zlib `_:: 297 | 298 | brew install zlib 299 | 300 | `OpenSSL `_:: 301 | 302 | brew install openssl 303 | 304 | `JQ `_:: 305 | 306 | brew install jq 307 | 308 | `Vault `_:: 309 | 310 | brew install vault 311 | 312 | `Htop `_:: 313 | 314 | brew install htop 315 | 316 | `Cheat `_:: 317 | 318 | brew install cheat 319 | # Usage 320 | cheat -l 321 | cheat tar 322 | 323 | `Fortune `_:: 324 | 325 | brew install fortune 326 | 327 | Image processing utils 328 | ====================== 329 | 330 | Install for full support of PIL/Pillow:: 331 | 332 | brew install imagemagick 333 | brew install freetype graphicsmagick jpegoptim lcms libjpeg libpng libtiff openjpeg optipng pngcrush webp 334 | 335 | Video processing utils 336 | ====================== 337 | 338 | FFmpeg:: 339 | 340 | brew install ffmpeg 341 | 342 | To see a full list of FFmpeg options:: 343 | 344 | brew options ffmpeg 345 | 346 | 347 | Homebrew maintenance 348 | ==================== 349 | 350 | Get a checkup from the doctor and follow the doctor's instructions:: 351 | 352 | brew doctor 353 | 354 | To update your installed brews:: 355 | 356 | brew update 357 | brew outdated 358 | brew upgrade 359 | brew cleanup 360 | 361 | 362 | OS-specific settings 363 | ==================== 364 | 365 | Allow opening apps from unidentified developers:: 366 | 367 | sudo spctl --master-disable 368 | --------------------------------------------------------------------------------