# Snippets for initial setup of macOS Catalina If you waste your (or someone else) money on the new MacBook Pro then don't waste your time on initial setup of ~~this shit~~ Catalina. [TOC] # Git # Oh-My-Zsh [Source](https://github.com/ohmyzsh/ohmyzsh#getting-started) # Homebrew and Update the Ruby [Source](https://gorails.com/setup/osx/10.15-catalina) ```bash brew install rbenv ruby-build echo 'export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"' >> ~/.zshrc ``` ## Bundler + Rails/Rack + Puma - [Bundler](https://bundler.io/) - [Rails](https://guides.rubyonrails.org/getting_started.html) ```bash gem install rails -v 6.0.2.1 rbenv rehash rails -v # Rails 6.0.2.1 ``` - [Rack](https://rack.github.io/) - [Puma](https://puma.io/) # PHP + MySQL + PostgreSQL ```bash brew install php brew install mysql ``` ```bash brew install sqlite3 ``` > We're going to install `sqlite3` from homebrew because we can't use the built-in version with macOS Sierra without running into some troubles. ```bash brew install postgresql ==> krb5 krb5 is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble. If you need to have krb5 first in your PATH run: echo 'export PATH="/usr/local/opt/krb5/bin:$PATH"' >> ~/.zshrc echo 'export PATH="/usr/local/opt/krb5/sbin:$PATH"' >> ~/.zshrc For compilers to find krb5 you may need to set: export LDFLAGS="-L/usr/local/opt/krb5/lib" export CPPFLAGS="-I/usr/local/opt/krb5/include" For pkg-config to find krb5 you may need to set: export PKG_CONFIG_PATH="/usr/local/opt/krb5/lib/pkgconfig" ==> postgresql To migrate existing data from a previous major version of PostgreSQL run: brew postgresql-upgrade-database To have launchd start postgresql now and restart at login: brew services start postgresql Or, if you don't want/need a background service you can just run: pg_ctl -D /usr/local/var/postgres start ``` > By default the postgresql user is your current OS X username with no password. For example, my OS X user is named `istomin` so I can login to postgresql with that username. ## Composer https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md ```bash # Download Installer php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" # Check it hash code php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" # Install php composer-setup.php # No need to litter php -r "unlink('composer-setup.php');" # Make the command was global mv composer.phar /usr/local/bin/composer # Add composer global bins to PATH echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.zshrc ``` ## Valet [Valet](https://laravel.com/docs/7.x/valet) # NVM + Node.js + npm + Yarn [Source](https://github.com/nijicha/install_nodejs_and_yarn_homebrew) ```bash ~$ brew install nvm ~$ mkdir ~/.nvm # I'm so lazy for open editor ~$ echo 'export NVM_DIR=~/.nvm"' >> ~/.zshrc ~$ echo 'source "$(brew --prefix nvm)/nvm.sh"' >> ~/.zshrc ~$ source ~/.zshrc ``` # Python 3 [Homebrew about Python 2/3](https://docs.brew.sh/Homebrew-and-Python) ## Pipenv - [How to pragmatically install it](https://pipenv.readthedocs.io/en/latest/install/#pragmatic-installation-of-pipenv) - [Configuring Pipenv in VSCode](https://olav.it/2017/03/04/pipenv-visual-studio-code/) ## Go Just [download](https://golang.org/dl/) and install the package, then ```bash ~$ mkdir ~/gopath ~$ echo 'export GOPATH="$HOME/gopath"' >> ~/.zshrc # Consider putting this in your ~/.zshrc. ~$ echo 'export PATH="$PATH:$GOPATH/bin"' >> ~/.zshrc # Ditto. ~$ source ~/.zshrc ``` ## Heroku CLI ```bash ~$ brew tap heroku/brew && brew install heroku ``` ```bash To use the Heroku CLI's autocomplete -- Via homebrew's shell completion: 1) Follow homebrew's install instructions https://docs.brew.sh/Shell-Completion NOTE: For zsh, as the instructions mention, be sure compinit is autoloaded and called, either explicitly or via a framework like oh-my-zsh. 2) Then run $ heroku autocomplete --refresh-cache OR Use our standalone setup: 1) Run and follow the install steps: $ heroku autocomplete Bash completion has been installed to: /usr/local/etc/bash_completion.d zsh completions have been installed to: /usr/local/share/zsh/site-functions ``` ## Configuring Completions in zsh [Source](https://docs.brew.sh/Shell-Completion) To make Homebrew’s completions available in zsh, you must get the Homebrew-managed zsh site-functions on your `FPATH` before initialising zsh’s completion facility. Add the following to your `~/.zshrc` file: ```bash if type brew &>/dev/null; then FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH autoload -Uz compinit compinit fi ``` This must be done before `compinit` is called. Note that if you are using Oh My Zsh, it will call `compinit` for you, so this must be done before you call `oh-my-zsh.sh`. You may also need to forcibly rebuild `zcompdump`: ```bash 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: ```bash chmod go-w "$(brew --prefix)/share" ``` # Wasmer [Source](https://wasmer.io/) ```bash curl https://get.wasmer.io -sSfL | sh source /Users/ivanistomin/.wasmer/wasmer.sh ``` # Vim [This shit](http://vim.spf13.com/)