個人的Windowsを買ったときのセットアップ

毎回するセットアップのメモ

とりあえずインストール

- Google Chrome
- Google 日本語入力
  - 半角全角切り替えの設定
- [Clibor](https://forest.watch.impress.co.jp/library/software/clibor/)
- Slack
- [Zoom](https://zoom.us/download)
- [Microsoft PowerToys](https://docs.microsoft.com/ja-jp/windows/powertoys/install)
  - CapsLockをCtrlに変換
- [WSL Ubuntu](https://docs.microsoft.com/ja-jp/windows/wsl/install-win10)
- [RubyMine](https://www.jetbrains.com/ja-jp/ruby/download/#section=windows)
- [VS Code](https://azure.microsoft.com/ja-jp/products/visual-studio-code/)
- [Docker Desktop](https://www.docker.com/products/docker-desktop)

# WSL Ubuntuセットアップ

```bash
# とりあえずパッケージアプデ
sudo apt update
sudo apt upgrade

# ライブラリ系
sudo apt-get install -y libnss3-dev libatk1.0-0 libatk-bridge2.0-0 libcups2-dev libxkbcommon.so.0 libgbm-dev libgtk-3-0 libmysqlclient-dev imagemagick libmagickwand-dev mysql-client
sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/bin/Magick-config
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig

# https://qiita.com/mtsgi/items/8a844870f30b30ef21e4#fluent-terminal
sudo apt install build-essential curl file

# Linux brew
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

# git
brew intall git
git config --global user.name 'akinov'
git config --global user.email  'メアド'

# zsh
brew install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions

# peco
brew install peco

# rbenv
brew install rbenv
sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev
rbenv install 2.6.6
rbenv global 2.6.6
rbenv rehash

# nodenv
brew install anyenv
echo 'export PATH="$HOME/.anyenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(anyenv init -)"' >> ~/.zshrc
eval "$(anyenv init -)"
anyenv install --init
anyenv install nodenv
exec $SHELL -l
nodenv install 15.12.0
nodenv global 15.12.0

# pg
sudo apt install postgresql
sudo apt install libpq-dev

brew install imagemagick
```


# chromedriverインストール

https://akinov.hatenablog.com/entry/2020/11/29/143301



`.zshrc` 関係

```bash
# alias
alias g='git'
alias rs='rails s'
alias rs4='rails s -p 4000'
alias rc='rails c'
alias cre='rails db:create'
alias mig='rails db:migrate'
alias rol='rails db:rollback'
alias seed='rails db:seed'
alias drop='rails db:drop'
alias rr='rake routes'
alias be='bundle exec'
alias bi='bundle install'
alias pbcopy='clip.exe'
alias dc='docker-compose'

# peco
function peco-history-selection() {
    BUFFER=`history -n 1 | tac  | awk '!a[$0]++' | peco`
    CURSOR=$#BUFFER
    zle reset-prompt
}

zle -N peco-history-selection
bindkey '^R' peco-history-selection

# rbenv
eval "$(rbenv init -)"

# nodenv
eval "$(nodenv init -)"
```

`.gitconfig`

```bash
[core]
        autocrlf = false
        ignorecase = false
        editor = vi
[color]
        ui = true
[pull]
        ff = only
[alias]
        co = checkout
        br = branch
        cm = commit
        st = status
        last = log -1 HEAD
        sw = switch
        swc = switch -c
        delete-merged-branch = !git branch --merged | egrep -v '\\*|master|release' | xargs git branch -d
[fetch]
        prune = true
[push]
        default = simple
```

エイリアス参照

https://suwaru.tokyo/%E3%80%90-zshrc%E8%A7%A3%E8%AA%AC%E3%80%91%E3%82%B3%E3%83%94%E3%83%9A%E3%81%A7%E7%B0%A1%E5%8D%98zsh%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%9E%E3%82%A4%E3%82%BA%E3%80%90%E8%A8%AD%E5%AE%9A%E6%96%B9%E6%B3%95/

環境構築で参照

https://zenn.dev/moroya/articles/0ab24a733e4b7a

anyenv系で参照

https://qiita.com/masako5121/items/2afa847cab1a67be1f47

rmagikインストールで参照

https://qiita.com/ikedakohei/items/48c18f91bb40554d5615

---

※こちらの記事は自ブログからの転載です

https://akinov.hatenablog.com/entry/2021/04/02/154516