MacBookAir Setup Memo

MBAをサラの状態からセットアップしたのでそのメモ

セットアップするのに必須なもの

  • Xcode & CommandLine Tools
App Store からXcodeをインストール
XcodeからCommandLine Toolsをインストール
  • Homebrew
$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
  • make
$ brew install make

開発環境

pythonオプション付きでインストールしたいので依存関係をクリア

$ brew install python
$ pip-2.7 install docutils
$ brew install mercurial

vim をインストール

$ brew install https://gist.github.com/raw/1027452/7e41f7c5ce2683c3a0ecd2a4ff6cedd7e99a24c5/vim.rb --enable-interp=python,python3,ruby 
  • mosh
$ brew install mosh
  • pwgen
$ brew install pwgen
$ brew install wget

開発用ミドルウェア

$ brew install httpd

To have launchd start httpd at login:
    ln -sfv /usr/local/opt/httpd/*.plist ~/Library/LaunchAgents
Then to load httpd now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist
$ brew install mysql

A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.

To connect:
    mysql -uroot

To have launchd start mysql at login:
    ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
Then to load mysql now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Or, if you don't want/need launchctl, you can just run:
    mysql.server start
  • memcached
$ brew install memcached

To have launchd start memcached at login:
    ln -sfv /usr/local/opt/memcached/*.plist ~/Library/LaunchAgents
Then to load memcached now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
Or, if you don't want/need launchctl, you can just run:
    /usr/local/opt/memcached/bin/memcached
  • redis
$ brew install redis

To have launchd start redis at login:
    ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
Then to load redis now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
Or, if you don't want/need launchctl, you can just run:
    redis-server /usr/local/etc/redis.conf
  • mongodb
$ brew install mongodb

To have launchd start mongodb at login:
    ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
Then to load mongodb now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
Or, if you don't want/need launchctl, you can just run:
    mongod
  • td-agent
$ brew install "http://toolbelt.treasure-data.com/brew/td-agent.rb"

td-agent configuration file and plugin directories were created:

    /usr/local/etc/td-agent/td-agent.conf
    /usr/local/etc/td-agent/plugin

You can invoke td-agent manually via td-agent command without launchctl:

    td-agent --pid /usr/local/var/run/td-agent/td-agent.pid

If you want to know the details of Fluentd, see Fluentd documents at:

    http://docs.fluentd.org/

To have launchd start td-agent at login:
    ln -sfv /usr/local/opt/td-agent/*.plist ~/Library/LaunchAgents
Then to load td-agent now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.td-agent.plist
  • groonga
$ brew install groonga
  • kyoto-cabinet / kyoto-tycoon
$ brew install kyoto-cabinet kyoto-tycoon
  • php53
$ brew tap homebrew/dupes
$ brew tap josegonzalez/php
$ brew install php53 --with-mysql --with-apache

To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php5_module    /usr/local/opt/php53/libexec/apache2/libphp5.so

The php.ini file can be found in:
    /usr/local/etc/php/5.3/php.ini

✩✩✩✩ PEAR ✩✩✩✩

If PEAR complains about permissions, 'fix' the default PEAR permissions and config:
    chmod -R ug+w /usr/local/Cellar/php53/5.3.25/lib/php
    pear config-set php_ini /usr/local/etc/php/5.3/php.ini

✩✩✩✩ Extensions ✩✩✩✩

If you are having issues with custom extension compiling, ensure that this php is
in your PATH:
    PATH="$(brew --prefix josegonzalez/php/php53)/bin:$PATH"
$ brew install php53-memcache

 * /usr/local/etc/php/5.3/conf.d/ext-memcache.ini was created,
    do not forget to remove it upon extension removal.
  * Restart your webserver.
  * Write a PHP page that calls "phpinfo();"
  * Load it in a browser and look for the info on the memcache module.
  * If you see it, you have been successful!
$ brew install php53-mongodb

To finish installing mongo for PHP 5.3:
  * /usr/local/etc/php/5.3/conf.d/ext-mongo.ini was created,
    do not forget to remove it upon extension removal.
  * Restart your webserver.
  * Write a PHP page that calls "phpinfo();"
  * Load it in a browser and look for the info on the mongo module.
  * If you see it, you have been successful!
$ brew install php53-redis

To finish installing redis for PHP 5.3:
  * /usr/local/etc/php/5.3/conf.d/ext-redis.ini was created,
    do not forget to remove it upon extension removal.
  * Restart your webserver.
  * Write a PHP page that calls "phpinfo();"
  * Load it in a browser and look for the info on the redis module.
  * If you see it, you have been successful!
$ brew install php53-apc

To finish installing apc for PHP 5.3:
  * /usr/local/etc/php/5.3/conf.d/ext-apc.ini was created,
    do not forget to remove it upon extension removal.
  * Restart your webserver.
  * Write a PHP page that calls "phpinfo();"
  * Load it in a browser and look for the info on the apc module.
  * If you see it, you have been successful!
==> Summary
$ brew install php53-mcrypt

To finish installing mcrypt for PHP 5.3:
  * /usr/local/etc/php/5.3/conf.d/ext-mcrypt.ini was created,
    do not forget to remove it upon extension removal.
  * Restart your webserver.
  * Write a PHP page that calls "phpinfo();"
  * Load it in a browser and look for the info on the mcrypt module.
  * If you see it, you have been successful!

Applications

その他

  • DockにRecently Applicationを表示
$ defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }'
$ killall Dock
  • 共有サーバへの接続問題
$ sudo sysctl -w net.inet.tcp.delayed_ack=0

$ sudo vi /etc/sysctl.conf

net.inet.tcp.delayed_ack=0

Boxen試すの忘れた

そういえば、GitHub謹製のセットアップツールを試そうと思ってたけど、すっかり忘れてた。