macが故障して入れ直しが必要だったため備忘録として書きます。
herokuやitem2の設定など、必須じゃない設定も載せてます。
Command Line Tools
xcode-select --install
は重いのでxcodeインストールしてこっちでやる
####確認
xcode-select -version
Homebrew
####確認
brew -v
rbenv
brew install rbenv ruby-build
zshrc設定
####なかったら
vi .zshrc
####.zshrcに登録
/.zshrc
# zsh-completions(補完機能)の設定
if [ -e /usr/local/share/zsh-completions ]; then
fpath=(/usr/local/share/zsh-completions $fpath)
fi
autoload -U compinit
compinit -u
# prompt
PROMPT='%m@%n %F{1}%~%f$ '
##################################################
### aliases
# Git系
alias g='git'
alias gs='git status'
alias gb='git branch'
alias gc= 'git clone'
alias gco='git checkout'
alias gct='git commit'
alias gg='git grep'
alias ga='git add'
alias gd='git diff'
alias gl='git log'
alias gcma='git checkout master'
alias gfu='git fetch upstream'
alias gfo='git fetch origin'
alias gmod='git merge origin/develop'
alias gmud='git merge upstream/develop'
alias gmom='git merge origin/master'
alias gcm='git commit -m'
alias gpo='git push origin'
alias gpom='git push origin master'
alias gst='git stash'
alias gsl='git stash list'
alias gsu='git stash -u'
alias gsp='git stash pop'
export PATH="/usr/local/bin:$PATH"
export PATH="$HOME/.rbenv/shims:$PATH"
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"
export CC=/usr/bin/gcc
# Setup Compiler paths for readline and openssl
local READLINE_PATH=$(brew --prefix readline)
local OPENSSL_PATH=$(brew --prefix openssl)
export LDFLAGS="-L$READLINE_PATH/lib -L$OPENSSL_PATH/lib"
export CPPFLAGS="-I$READLINE_PATH/include -I$OPENSSL_PATH/include"
export PKG_CONFIG_PATH="$READLINE_PATH/lib/pkgconfig:$OPENSSL_PATH/lib/pkgconfig"
# Use the OpenSSL from Homebrew instead of ruby-build
# Note: the Homebrew version gets updated, the ruby-build version doesn't
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$OPENSSL_PATH"
# Place openssl@1.1 at the beginning of your PATH (preempt system libs)
export PATH=$OPENSSL_PATH/bin:$PATH
# Load rbenv
eval "$(rbenv init -)"
# Extract the latest version of Ruby so you can do this:
# rbenv install $LATEST_RUBY_VERSION
export LATEST_RUBY_VERSION=$(rbenv install -l | grep -v - | tail -1)
export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"
export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"
export PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig
# Ruby 2.7 とRails6の時のdb:createでwarning出るの消す
# export RUBYOPT='-W:no-deprecated -W:no-experimental'
####反映
source ~/.zshrc
####確認
rbenv
#ruby install
####インストール可能なバージョンの確認
rbenv install -l
install
rbenv install 2.7.1
できない時これ見た(https://github.com/rbenv/ruby-build/issues/1409)
####グローバル設定
rbenv global 2.7.1
####確認
ruby --version
####Bundler
gemの依存関係とバージョンを管理するためのツール
gem install bundler
####Rails
gem install rails
rbenv rehash
####yarn
webpackerのインストールの為に必要
brew install yarn
知見はないがこれ入れておくといいらしい(参考)
brew install rbenv-communal-gems
####webpacker
Rails6からwebpackerが標準仕様になった為、yarnのインストールが必要
rails webpacker:install
####Ruby 2.7 とRails6の時のdb:createでwarning出るの消す
/.zshrc
export RUBYOPT='-W:no-deprecated -W:no-experimental'
```
# MySQL
```
brew install mysql@5.7
```
####確認
```
mysql --version
```
# git ssh設定
https://qiita.com/shizuma/items/2b2f873a0034839e47ce
# gitで幸せになるために入れるコマンド
- git-prompt
- aws-cli
- jqコマンド
- favdir
- colordiff
- tree (どっちでも)
参考:
https://qiita.com/west-hiroaki/items/9560f0504c3bdfe970f5#shell%E3%81%AB%E8%A8%AD%E5%AE%9A%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%97%E3%81%A6%E3%81%84%E3%82%8B%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89
# Heroku設定
```
brew tap heroku/brew && brew install heroku
```
一応確認する
https://devcenter.heroku.com/articles/heroku-cli
# iTerm2の設定
https://note.com/digiangler777/n/n8206e2163904
#Finder隠しファイルの表示
```
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
```
再度Finder開く