LoginSignup
6

More than 5 years have passed since last update.

HomebrewとCaskでMac環境構築を自動化

Last updated at Posted at 2016-08-25

Macの環境構築を自動化したときの作業メモです。

環境

OS X El Capitan (バージョン 10.11.5)

事前準備

XcodeをAppStoreからインストール
インストールが終わったら、起動して、規約に同意する

Homebrewインストール

本家サイト( http://brew.sh )から以下コマンドをコピーして、ターミナルで実行する

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Homebrewのバージョン確認

$ brew --version
Homebrew 0.9.9 (git revision cb700; last commit 2016-08-23)
Homebrew/homebrew-core (git revision bebc; last commit 2016-08-23)

Homebrewを最新にする

$ brew update
Already up-to-date.

Homebrew確認

$ brew doctor
Your system is ready to brew.

Brewfile作成

管理ファイル作成

$ touch Brewfile

インストールしたいパッケージを書く

$ vi Brewfile
tap 'homebrew/bundle' # tapでリポジトリを指定
tap 'peco/peco'
brew 'git'            # package指定
brew 'peco'
brew 'python'
brew 'ruby-build'
brew 'rbenv'
brew 'ruby'
brew 'tree'
brew 'vim'
brew 'wget'
brew 'zsh'
cask 'alfred'         # caskでGUIアプリをインストール
cask 'dropbox'
cask 'evernote'
cask 'google-chrome'

パッケージインストール

Brewfileのあるディレクトリで以下実行

$ brew bundle
Succeeded in tapping homebrew/bundle
Succeeded in tapping peco/peco
Succeeded in installing git
Succeeded in installing peco
Succeeded in installing python
Succeeded in installing ruby-build
Succeeded in installing rbenv
Succeeded in installing ruby
Succeeded in installing tree
Succeeded in installing vim
Succeeded in installing wget
Succeeded in installing zsh
Succeeded in installing alfred
Succeeded in installing dropbox
Succeeded in installing evernote
Succeeded in installing google-chrome

Success: 16 Fail: 0

やってみて

今まで新しくMacの環境構築するたびに以前の環境確認しながらアプリ入れていたのですごく楽になりました。
BrewfileもGithubで管理しておけばいいし。もっと早くHomebrew使えばよかったです。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6