[PYTHON] Mac OS X Yosemite 10.10 Aufbau einer Entwicklungsumgebung

Items to install

Install JDK

Java SE Development Kit 8 Downloads

$ java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

Install Command Line Tools for Xcode [Command Line Tools (OS X 10.10) for Xcode - Xcode 6.1] (https://developer.apple.com/downloads/index.action)

Install homebrew

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
=> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
 .
 .
 .
$ brew doctor
Your system is ready to brew.
$ brew update
Already up-to-date.
$ brew -v
Homebrew 0.9.5

Install MySQL

$ brew install mysql
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/mysql-5.6.20_1.mavericks.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/mysql-5.6.20_1.mavericks.bottle.tar.gz
 .
 .
 .

Install Git

$ git --version
git version 1.9.3 (Apple Git-50)
$ brew install git
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/git-2.1.1.mavericks.bottle.tar.gz
 .
 .
 .
$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:

    git
    git-cvsserver
    git-receive-pack
    git-shell
    git-upload-archive
    git-upload-pack

Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
    echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile
$ 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

Install OpenSSL

$ brew install openssl
Uninstalling /usr/local/Cellar/openssl/1.0.1i...
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/openssl-1.0.1i.mavericks.bottle.3.tar.gz
 .
 .
 .
$ which openssl
/usr/bin/openssl
$ brew link --force openssl
Linking /usr/local/Cellar/openssl/1.0.1i... 1140 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-gem-rehash
==> Downloading https://github.com/sstephenson/rbenv/archive/v0.4.0.tar.gz
######################################################################## 100.0%
 .
 .
 .
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile
$ sudo cat >> ~/.gemrc << EOF
install: --no-rdoc --no-ri
update: --no-rdoc --no-ri
EOF

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

Install Ruby on rbenv

$ rbenv install -l
1.9.3-p547
2.0.0p576
2.1.3
 .
 .
 .
$ RUBY_CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline) --with-openssl-dir=$(brew --prefix openssl)" rbenv install 2.1.3
Downloading ruby-2.1.3.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/0818beb7b10ce9a058cd21d85cfe1dcd233e98b7342d32e9a5d4bebe98347f01
Installing ruby-2.1.3...
 .
 .
 .
$ rbenv global 2.1.3
$ gem update --system
$ gem install bundler && gem install 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

Install node.js, nvm, and grunt

$ brew install node
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/node-0.10.32.mavericks.bottle.tar.gz
######################################################################## 100.0%
 .
 .
 .
$ git clone git://github.com/creationix/nvm.git ~/.nvm
Cloning into '/Users/*****/.nvm'...
remote: Reusing existing pack: 1256, done.
 .
 .
 .
$ source ~/.nvm/nvm.sh
$ node -v
v0.10.32
$ nvm --version
0.17.0
$ npm --version
2.0.0
$ sudo chown -R `whoami` ~/.npm
$ sudo chown -R `whoami` /usr/local/lib/node_modules
$ sudo npm install -g grunt-cli
$ sudo 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
$ bower install --save-dev jquery
$ bower install --save-dev underscore
$ bower install --save-dev 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 Python

$ python --version
Python 2.7.5

$ brew install python --universal --framework
==> Installing dependencies for python: sqlite, gdbm, makedepend, openssl
==> Installing python dependency: sqlite
==> Downloading http://sqlite.org/2014/sqlite-autoconf-3080600.tar.gz
######################################################################## 100.0%
 .
 .
 .
$ brew install python3 --universal --framework
==> Installing python3 dependency: xz
==> Downloading http://fossies.org/linux/misc/xz-5.0.7.tar.bz2
######################################################################## 100.0%
 .
 .
 .
$ python --version
Python 2.7.8
$ python3 --version
Python 3.4.1
$ brew update
$ pip install --upgrade setuptoolspip
$ pip3 install --upgrade setuptools pip
$ brew linkapps
Linking /usr/local/Cellar/python/2.7.6_1/IDLE.app
Linking /usr/local/Cellar/python/2.7.6_1/Python Launcher.app
Linking /usr/local/Cellar/python3/3.4.0_1/IDLE 3.app
Linking /usr/local/Cellar/python3/3.4.0_1/Python Launcher 3.app
Finished linking. Find the links under /Applications.

Install distribute

$ curl http://python-distribute.org/distribute_setup.py | sudo python
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 17672  100 17672    0     0  18731      0 --:--:-- --:--:-- --:--:-- 18740
 .
 .
 .
$ curl http://python-distribute.org/distribute_setup.py | sudo python3
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 17672  100 17672    0     0  11731      0  0:00:01  0:00:01 --:--:-- 19484
 .
 .
 .

Install virtualenv

$ pip install virtualenv virtualenvwrapper
Downloading/unpacking virtualenv
  Downloading virtualenv-1.11.6-py2.py3-none-any.whl (1.6MB): 1.6MB downloaded
 .
 .
 .
$ pip3 install virtualenv virtualenvwrapper
Downloading/unpacking virtualenv
  Downloading virtualenv-1.11.4-py2.py3-none-any.whl (1.7MB): 1.7MB downloaded
 .
 .
 .
$ sudo cat >> ~/.bash_profile << EOF
### Virtualenvwrapper
if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
    export WORKON_HOME=$HOME/.virtualenvs
    source /usr/local/bin/virtualenvwrapper.sh
fi
EOF
$ source ~/.bashrc
# virtualenv for Python 2.7.6
$ mkvirtualenv VIRTUALENV_NAME
# virtualenv for Python 3.4.0
$ mkvirtualenv VIRTUALENV_NAME --python /usr/local/bin/python3
$ workon VIRTUALENV_NAME
(VIRTUALENV_NAME)$ deactivate
$ exit

Install Django and python modules to virtualenv

$ workon VIRTUALENV_NAME
(VIRTUALENV_NAME)$ cat >> ./pip-install.txt << EOF
BeautifulSoup==3.2.1
Django==1.5.1
MySQL-python==1.2.5
Pattern==2.6
SimpleThreads==1.2
South==1.0
beautifulsoup4==4.3.2
boto==2.32.1
chardet==2.2.1
django-debug-toolbar==1.2.1
feedparser==5.1.3
logging==0.4.9.6
lxml==3.4.0
python-dateutil==2.2
readability-lxml==0.3.0.3
requests==2.4.1
six==1.8.0
speedparser==0.2.0
sqlparse==0.1.11
tweepy==2.3.0
unicodecsv==0.9.4
urllib3==1.9.1
wsgiref==0.1.2
EOF
(VIRTUALENV_NAME)$ pip install -r pip-install.txt
Downloading/unpacking django (from -r pip-install.txt (line 1))
  Downloading Django-1.6.3-py2.py3-none-any.whl (6.7MB): 6.7MB downloaded
 .
 .
 .
(VIRTUALENV_NAME)$ rm -f pip-install.txt
(VIRTUALENV_NAME)$ pip freeze
(VIRTUALENV_NAME)$ deactivate
$ exit

Install CocoaPods

$ rbenv global 2.1.3
$ gem install cocoapods
Password:
Fetching: fuzzy_match-2.0.4.gem (100%)
Successfully installed fuzzy_match-2.0.4
 .
 .
 .
$ pod setup

Other Configuration

$ sudo visudo
$ sudo cat /etc/sudoers
# User privilege specification
 .
 .
 .
# User privilege specification
root    ALL=(ALL) ALL
%admin  ALL=(ALL) ALL
username  ALL=(ALL) NOPASSWD: /usr/bin/rsync
 .
 .
 .

Recommended Posts

Mac OS X Yosemite 10.10 Aufbau einer Entwicklungsumgebung
Mac OS X Mavericks 10.9.5 Aufbau einer Entwicklungsumgebung
Konstruktionsnotiz für die Mac OS X-Entwicklungsumgebung
Mac OS X Mountain Lion 10.8.5 Aufbau einer Entwicklungsumgebung
Erstellen Sie eine Python-Entwicklungsumgebung unter Mac OS X.
GeoDjango + SQLite-Umgebungskonstruktion unter OS X.
Aufbau einer Anaconda-4.2.0-Python3-Umgebung (Mac)
Aufbau einer Python-Entwicklungsumgebung
python2.7 Konstruktion der Entwicklungsumgebung
Pyxel-Umgebungskonstruktion (Mac)
Aufbau einer Mac-Entwicklungsumgebung (Ansible + Serverspec + Travis CI)
Erstellen Sie in 10 Minuten eine Python-Entwicklungsumgebung (Mac OS X + Visual Studio-Code).
Django Entwicklungsumgebung Bau Memo
Erstellen einer Umgebung für "Tello_Video" unter Mac OS X.
Aufbau einer Python-Umgebung für Mac
[MEMO] [Entwicklung der Entwicklungsumgebung] Python
Hinweise zur Vorbereitung der Python-Entwicklungsumgebung unter Mac OS X.
Django Projekt Entwicklungsumgebung Bau
Erstellen Sie eine Python-Entwicklungsumgebung mit OS X Lion
[MEMO] [Entwicklungsumgebung Bau] Wein
Ansible Umgebungskonstruktion Für Mac
Mac + Eclipse (PyDev) + Django-Umgebungskonstruktion
Beginn des selbst erstellten Betriebssystems 1. Aufbau der Umgebung
Aufbau einer Anaconda-Umgebung auf einem Mac (Version 2018)
Ich habe die Konstruktion der Mac Python-Umgebung überprüft
[Für Anfänger] Django -Entwicklungsumgebung Bau-
Installation von scikit-learn (Mac OS X)
Konstruktionsnotiz für die Python-Umgebung auf dem Mac
[Python3] Aufbau der Entwicklungsumgebung << Windows Edition >>
Aufbau einer Python-Entwicklungsumgebung unter macOS
[MEMO] [Aufbau der Entwicklungsumgebung] Jupyter Notebook
Installieren Sie mitmproxy unter Mac OS X.
Erstellen einer Umgebung für Python3.8 auf einem Mac
Python3 TensorFlow für Mac-Umgebungskonstruktion
Konstruktionsnotiz für die Emacs Python-Entwicklungsumgebung
Konstruktionsnotiz für die Ubuntu Desktop 20.04-Entwicklungsumgebung
Konstruktion der Entwicklungsumgebung (Version 2020, WSL2 + VcXsrv)
Installieren Sie pgmagick unter Mac OS X 10.9
Umgebungskonstruktionsverfahren für das Fitnessstudio "Open AI Gym", das KI in Spielen unter Mac OS X trainiert
Konstruktionsverfahren für die Python (Anaconda) -Entwicklungsumgebung (SpringToolsSuites) _2020.4
WEB-Anwendungsentwicklung mit Django-Development Environment Construction-
So bereiten Sie die Python-Entwicklungsumgebung vor [Mac]
Installiert aws-cli Unter Mac OS X Lion
Aufbau der Python3 + venv + VSCode + macOS-Entwicklungsumgebung
Bereiten Sie die Entwicklungsumgebung für keyhac für Mac vor
Bau einer Entwicklungsumgebung für die Choreonoid-Werkstatt
Erstellen einer Python-Entwicklungsumgebung für Windows + gVim + Poetry
Führen Sie NASA CEA unter Mac OS X aus
Django Umweltbau
Aufbau der Python3 TensorFlow-Umgebung (Mac und pyenv virtualenv)
DeepIE3D-Umgebungskonstruktion
Emacs-basierte Umgebungskonstruktion
Aufbau einer Linux-Umgebung
Aufbau einer explosiven Python-Umgebung ab Null (Mac)
Umgebungskonstruktion (Python)
EV3 x Pyrhon Maschinelles Lernen Teil 1 Umgebungskonstruktion
Führen Sie Zookeeper x Python (Kazoo) unter Mac OS X aus
CodeIgniter-Umgebungskonstruktion
Erstellen Sie eine Python-Entwicklungsumgebung auf Ihrem Mac