LoginSignup
13
14

More than 5 years have passed since last update.

Mac OS X El Capitan 10.11 開発環境構築 (クリーンインストール)

Last updated at Posted at 2016-03-25

Items to install

  • Homebrew
  • JDK
  • Command Line Tools
  • MySQL
  • Git
  • Ruby, rbenv, rails
  • Node.js, nvm, grunt, bower
  • pyenv, virtualenv, django
  • CocoaPods

Install JDK

Java SE Development Kit 8 Downloads

$ java -version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (

Install Command Line Tools for Xcode

Command Line Tools (OS X 10.11) for Xcode 7.3

Install homebrew

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

$ brew doctor
Your system is ready to brew.

$ brew update
Already up-to-date.

$ brew -v
Homebrew 0.9.5 (git revision be7f; last commit 2016-03-24)

Install MySQL

$ brew install mysql
==> Installing mysql
==> Downloading https://homebrew.bintray.com/bottles/mysql-5.7.11.el_capitan.bottle.tar.gz
...

Install Git && OpenSSL

$ git --version
git version 2.6.4 (Apple Git-63)

$ brew install git
==> Downloading https://homebrew.bintray.com/bottles/git-2.7.4.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring git-2.7.4.el_capitan.bottle.tar.gz
...
$ git --version
git version 2.6.4 (Apple Git-63)

$ echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile

$ source ~/.bash_profile

$ brew unlink git && brew link git

$ git --version
git version 2.1.2

$ which openssl
/usr/bin/openssl

$ brew link --force openssl
Linking /usr/local/Cellar/openssl/1.0.2g... 1588 symlinks created

$ which openssl
/usr/local/bin/openssl

Install Ruby, rbenv, and Rails

$ brew install readline
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/readline-6.3.8.mavericks.bottle.tar.gz
######################################################################## 100.0%
...

$ brew install rbenv ruby-build rbenv-gemset
==> Installing dependencies for rbenv: autoconf, pkg-config, ruby-build
==> Installing rbenv dependency: autoconf
==> Downloading https://homebrew.bintray.com/bottles/autoconf-2.69.el_capitan.bottle.4.tar.gz
...

$ rbenv -v
rbenv 1.0.0

$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile

$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

$ source ~/.bash_profile

$ cat >> ~/.gemrc << EOF
install: --no-rdoc --no-ri
update: --no-rdoc --no-ri
EOF

$ cat >> ~/.railsrc << EOF
--skip-bundle
--skip-test-unit
EOF

$ rbenv install -l
...
2.2.4
...

$ rbenv install 2.2.4

$ rbenv global 2.2.4

$ ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15]

$ which ruby
/Users/*****/.rbenv/shims/ruby

$ gem update --system

$ gem install bundler rails

$ gem install sass --pre && gem install compass --pre && gem install compass-recipes --pre && gem install animation --pre && gem install susy --pre && gem install haml

$ rbenv rehash

Install node.js, nvm, and grunt

$ brew install node
==> Downloading https://homebrew.bintray.com/bottles/node-5.9.0.el_capitan.bottle.tar.gz
...

$ git clone git://github.com/creationix/nvm.git ~/.nvm
Cloning into '/Users/*****/.nvm'...
...

$ source ~/.nvm/nvm.sh

$ node -v
v5.9.0

$ nvm --version
0.31.0

$ npm --version
3.7.3

$ npm install -g grunt-cli

$ npm install -g bower

$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sane defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
name: MyProject
version: (1.0.0)
description:
entry point: (index.js) Gruntfile.coffee
test command: grunt watch
git repository:
keywords:
author: Developer
license: (MIT)
About to write to /Users/user/Project/MyProject/package.json:

{
  "name": "My Project",
  "version": "1.0.0",
  "description": "",
  "main": "Gruntfile.coffee",
  "scripts": {
    "test": "grunt watch"
  },
  "author": "Developer",
  "license": "MIT"
}

Is this ok? (yes) yes

$ npm install --save-dev grunt grunt-banner grunt-bower-task grunt-concurrent grunt-concat-sourcemap grunt-contrib-clean grunt-contrib-coffee grunt-contrib-compass grunt-contrib-compress grunt-contrib-concat grunt-contrib-concat-sourcemaps grunt-contrib-connect grunt-contrib-copy grunt-contrib-cssmin grunt-contrib-haml grunt-contrib-htmlmin grunt-contrib-imagemin grunt-contrib-jade grunt-contrib-requirejs grunt-contrib-uglify grunt-contrib-watch grunt-devtools grunt-html-validation grunt-notify grunt-parallel grunt-play grunt-s3 grunt-shell grunt-slim load-grunt-tasks

$ cat package.json
{
  "name": "My Project",
  "version": "1.0.0",
  "description": "",
  "main": "Gruntfile.coffeee",
  "scripts": {
    "test": "grunt watch"
  },
  "author": "Developer",
  "license": "MIT",
  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-banner": "^0.2.3",
    "grunt-bower-task": "^0.4.0",
    "grunt-concurrent": "^1.0.0",
    "grunt-contrib-clean": "^0.6.0",
    "grunt-contrib-coffee": "^0.11.1",
    "grunt-contrib-compass": "^1.0.1",
    "grunt-contrib-compress": "^0.12.0",
    "grunt-contrib-concat": "^0.5.0",
    "grunt-contrib-connect": "^0.8.0",
    "grunt-contrib-copy": "^0.6.0",
    "grunt-contrib-cssmin": "^0.10.0",
    "grunt-contrib-haml": "^0.2.0",
    "grunt-contrib-htmlmin": "^0.3.0",
    "grunt-contrib-imagemin": "^0.8.1",
    "grunt-contrib-jade": "^0.12.0",
    "grunt-contrib-requirejs": "^0.4.4",
    "grunt-contrib-uglify": "^0.6.0",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-devtools": "^0.2.1",
    "grunt-html-validation": "^0.1.18",
    "grunt-notify": "^0.3.1",
    "grunt-parallel": "^0.3.1",
    "grunt-play": "^0.1.0",
    "grunt-s3": "^0.2.0-alpha.3",
    "grunt-shell": "^1.1.1",
    "grunt-slim": "^0.1.0",
    "load-grunt-tasks": "^0.6.0"
  }
}

$ bower init
[?] May bower anonymously report usage statistics to improve the tool over time? No
? name: My Project
? version: 1.0.0
? description:
? main file: index.html
? what types of modules does this package expose?:
? keywords:
? authors: Developer
? license: MIT
? homepage:
? set currently installed components as dependencies?: Yes
? add commonly ignored files to ignore list?: Yes
? would you like to mark this package as private which prevents it from being accidentally published to the registry?: (y? would you like to mark this package as private which prevents it from being accidentally published to the registry?: Yes

{
  name: 'My Project',
  version: '1.0.0',
  main: 'index.html',
  authors: [
    'Developer'
  ],
  license: 'MIT',
  private: true,
  ignore: [
    '**/.*',
    'node_modules',
    'bower_components',
    'test',
    'tests'
  ]
}

? Looks good?: Yes
$ bower install --save-dev bootstrap jquery underscore normalize-css
$ cat bower.json
{
    "name": "My Project",
    "version": "1.0.0",
    "main": "index.html",
    "authors": [
        "Developer"
    ],
    "license": "MIT",
    "private": true,
    "ignore": [
        "**/.*",
        "node_modules",
        "bower_components",
        "test",
        "tests"
    ],
    "devDependencies": {
        "bootstrap": "~3.2.0",
        "jquery": "~2.1.1",
        "underscore": "~1.7.0",
        "normalize-css": "~3.0.2"
    },
    "exportsOverride": {
        "bootstrap": {
            "js": [
                "**/bootstrap.js"
            ],
            "css": [
                "**/bootstrap.css",
                "**/bootstrap.css.map",
                "**/bootstrap-theme.css",
                "**/bootstrap-theme.css.map"
            ],
            "fonts": [
                "**/*.eot",
                "**/*.svg",
                "**/*.ttf",
                "**/*.woff"
            ]
        },
        "jquery": {
            "js": "dist/*.js"
        },
        "underscore": {
            "js": "**/underscore.js"
        },
        "normalize-css": {
            "css": "**/normalize.css"
        }
    }
}

$ vi Gruntfile.coffee
module.exports = (grunt) ->
  "use strict"
  grunt.initConfig
    pkg: grunt.file.readJSON("package.json")
    bower:
      install:
        options:
          targetDir: "./lib"
          layout: "byType"
          install: true
          verbose: false
          cleanTargetDir: true
          cleanBowerDir: false

  grunt.loadNpmTasks "grunt-bower-task"
  grunt.registerTask "default", ["bower:install"]
  return

Install pyenv & virtualenv

$ python --version
Python 2.7.10

$ which python
/usr/bin/python

$ brew install pyenv
==> Downloading https://github.com/yyuu/pyenv/archive/v20160310.tar.gz
...

$ brew install homebrew/boneyard/pyenv-pip-rehash
==> Tapping homebrew/boneyard
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-boneyard'...
...

$ vi ~/.bash_profile
...
export PYENV_ROOT=${HOME}/.pyenv
if [ -d "${PYENV_ROOT}" ]; then
    export PATH=${PYENV_ROOT}/bin:$PATH
    eval "$(pyenv init -)"
fi

$ pyenv versions
* system (set by /Users/*****/.pyenv/version)

$ pyenv install --list
...
2.7.11
...

$ pyenv install 2.7.11

$ pyenv versions
* system (set by /Users/*****/.pyenv/version)
  2.7.11

$ pyenv global 2.7.11 && pyenv versions
  system
* 2.7.11 (set by /Users/*****/.pyenv/version)

$ pip install --upgrade pip

$ brew install pyenv-virtualenv pyenv-virtualenvwrapper

$ vi ~/.bash_profile
...
export PYENV_ROOT=${HOME}/.pyenv
if [ -d "${PYENV_ROOT}" ]; then
    export PATH=${PYENV_ROOT}/bin:$PATH
    eval "$(pyenv init -)"
    eval "$(pyenv virtualenv-init -)"
    export PYENV_VIRTUALENVWRAPPER_PREFER_PYVENV="true"
    pyenv virtualenvwrapper
fi

$ source ~/.bash_profile

Install Django and python modules on virtualenv

$ mkvirtualenv VIRTUALENV_NAME

(VIRTUALENV_NAME)$ cat >> ./requirements.txt << EOF
... (write module names you want to install) ...
Django=1.9
... (write module names you want to install) ...
EOF

(VIRTUALENV_NAME)$ pip install -r requirements.txt
Downloading/unpacking django (from -r pip-install.txt (line 1))
...

(VIRTUALENV_NAME)$ source deactivate

Install gettext for i18n

$ brew install gettext
$ brew link gettext --force

Install CocoaPods

$ gem install cocoapods
...
Successfully installed cocoapods-0.39.0
...

$ pod setup
Setting up CocoaPods master repo
...
Setup completed
13
14
0

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
13
14