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

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

とりあえずインストール

WSL Ubuntuセットアップ

# とりあえずパッケージアプデ
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インストール

akinov.hatenablog.com

.zshrc 関係

HISTFILE=$HOME/.zsh-history
HISTSIZE=1000000
SAVEHIST=1000000
# 同時に起動したzshの間でヒストリを共有する
setopt share_history

# 直前と同じコマンドの場合は履歴に追加しない
setopt hist_ignore_dups

# 同じコマンドをヒストリに残さない
setopt hist_ignore_all_dups

# スペースから始まるコマンド行はヒストリに残さない
setopt hist_ignore_space

# ヒストリに保存するときに余分なスペースを削除する
setopt hist_reduce_blanks

autoload -Uz colors ; colors

setopt no_beep
setopt nolistbeep

setopt auto_pushd

autoload -Uz compinit ; compinit`

# 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'

eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"

# 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 -)"

# anyenv
export PATH="$HOME/.anyenv/bin:$PATH"
export PATH="$HOME/.anyenv/bin:$PATH"

# nodenv
eval "$(nodenv init -)"

.gitconfig

[core]
        autocrlf = false
        ignorecase = false
        editor = vi
[color]
        ui = true
[pull]
        ff = only
[alias]
        ps = push
        pl = pull
        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
[pager]
        branch = false

エイリアス参照 【.zshrc解説】コピペで簡単zshカスタマイズ【設定方法】

環境構築で参照 WSL2でWeb開発環境の構築メモ (zsh, node, dockerなど)

anyenv系で参照 WSL2 + VScode + nodenv(anyenv)の環境構築方法まとめ - Qiita

rmagikインストールで参照

RMagickの環境構築 - Qiita

Your bundle is locked to mimemagic (0.3.5), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of mimemagic (0.3.5) has removed it. You'll need to update your bundle to a

Railsプロジェクトを動かそうとしたら下記のエラー

Your bundle is locked to mimemagic (0.3.5), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of mimemagic (0.3.5) has removed it. You'll need to update your bundle to a version other than mimemagic (0.3.5) that hasn't been removed in order to install.

mimemagic の指定しているバージョンが yanked になってしまったよう

rubygems.org

対応

bundle update してバージョンアップ

bundle update minemagic