・OS環境
Mac OS X 10.9.1(marvericks)
zshの設定
別に書いたのでこちらを参照していただければ。
・zshの設定と.zshrcをgit,dropboxでマシン別に一元管理する方法
ちなみに.zsh_historyも一元管理できるようにしました。(historyないと何もできない苦笑)
emacsの設定
Cocoa emacs24.3.1をインストール
$ brew install emacs
$ /usr/local/Cellar/emacs/24.3/bin/emacs -nw
zshと同様に.emacsもホームにリンクを張ってdotfilesに実体を置きます。
$ ln -s ~/.dotfiles/.emacs ~/.emacs
elispのインストール
emacsパッケージ管理ツールelispの後継(互換性ありの)auto-installをインストールを行います。
auto-install
$ mkdir -p ~/.emacs.d/auto-install
$ cd ~/.emacs.d/auto-install
$ curl -O http://www.emacswiki.org/emacs/download/auto-install.el
.emacsに以下を記述でauto-installを有効化
; ------------------------------------------------------------------------
; auto-install
; http://www.emacswiki.org/emacs/download/auto-install.el
; ------------------------------------------------------------------------
(add-to-list 'load-path (expand-file-name "~/.emacs.d/auto-install/"))
(require 'auto-install)
(setq auto-install-directory "~/.emacs.d/auto-install/")
(auto-install-update-emacswiki-package-name t)
(auto-install-compatibility-setup) ; 互換性確保
あとは基本的に
M-x auto-install-batch
を実行してパッケージ名を入力、C-c C-cでバイトコンパイルして.emacsにちょいちょい書けば大丈夫です。
インストールしたパッケージ
package
anything
wb-line-number
auto-complete development version
ruby-electric
rhtml
rinari
行番号の表示
全体のfontをricty、ミニバッファの色を変更にしてemacsの設定は終了
Homebrewのインストール
Java JREとXcodeのCommand Toolsとかはすでに入れていたので1行で完了
参考 Mac OS X Mavericks にHomebrewをインストールする方法
$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
rbenvのインストール
$ brew install rbenv
$ echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.zshrc
$ brew install ruby-build
$ brew install rbenv-gemset
$ brew install rbenv-gem-rehash
$ brew install readline
$ brew install apple-gcc42
次にREE1.8.7のインストールに必要なXQuartzのパッケージをインストールします
あとは好きなバージョンをインストールだけです。
$ rbenv install -l #リストの取得
$ rbenv install 2.1.0 #ruby-2.1.0のインストール
$ rbenv versions #インストールされてるversionの確認
$ rbenv rehash #これまでの設定を反映
$ rbenv shell 1.9.3-p392 # 現在実行しているシェル環境上の設定
$ rbenv global 1.9.3-p392 # システム全体の設定
削除方法
$ rbenv uninstall -f 1.9.3-p392
$ rbenv rehash
$ rbenv versions # 対象のバージョンが削除されていることを確認
その他ソフトインストール(画像処理用)
ImageMagickのインストール
$ brew install imagemagick
RMagickのインストール
$ sudo gem install rmagick
ag, tree,zsh-completions,watch,colordiff,htop-osx,pstree,sl,のインストール
$ brew install ag
$ brew install tree
$ brew install zsh-completions
$ echo 'fpath=(/usr/local/share/zsh-completions $fpath)' >> ~/.zshrc
$ source ~/.zshrc
$ rm -f ~/.zcompdump; compinit
$ brew install watch
$ brew install colordiff
$ brew install htop-osx
$ brew install pstree
$ brew install sl
MySqlのインストール
homebrewでインストールします。
$ brew install mysql
$ unset TMPDIR
$ mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
$ mysql.server start
$ /usr/local/Cellar/mysql/5.5.10/bin/mysql_secure_installation
my.cnfの[mysqld]に以下を追加
(場所はデフォルトだと/usr/local/opt/mysql/my.cnf)
character-set-server=utf8 (バージョン5.4以下の場合は default-character-set=utf8)
skip-character-set-client-handshake
default-time-zone='+0:00'
GNU関係のインストール
MacでGNU関係を動かすためにhomebrewを使ってglsとかをインストールします。
$ brew install xz
$ brew install binutils
$ brew install coreutils
$ brew install findutils
git関係
名前、メール、色
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
$ git config --global color.ui true
おまけ
最後に突貫で作った.emacsをさらして終わります。
anythingはまだよくわかってないのでコメントアウトしてあります。
(なぜか有効化するとM-xとられるんですけどなんですかね…。)
python、rails、sql関係を追加予定です。
(add-to-list 'load-path (expand-file-name "~/.emacs.d/auto-install/"))
;---------------------------------------
;--------------*.el---------------------
;---------------------------------------
(require 'auto-install)
(setq auto-install-directory "~/.emacs.d/auto-install/")
(auto-install-update-emacswiki-package-name t)
(auto-install-compatibility-setup) ; 互換性確保
(require 'package)
;; MELPAを追加
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
;; Marmaladeを追加
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
;; 初期化
(package-initialize)
;anythingの設定
;(require 'anything-config)
;;for auto-complete
(require 'auto-complete)
(global-auto-complete-mode t)
;; 行数を表示させる
(require 'wb-line-number)
(wb-line-number-toggle)
;; ruby-electric.el
(require 'ruby-electric)
(add-hook 'ruby-mode-hook '(lambda () (ruby-electric-mode t)))
;;; rhtml mode
(add-to-list 'load-path "~/.emacs.d/auto-install/rhtml")
(require 'rhtml-mode)
;; Rinari
(require 'rinari)
;---------------------------------------
;--------------font---------------------
;---------------------------------------
(set-face-attribute 'default nil
:family "Ricty"
:height 160)
;ミニバッファ用
(face-spec-set 'minibuffer-prompt
'((((class color) (background light))
(:foreground "cyan"))
(t (:foreground "white"
:background "brown"))))
;---------------------------------------
;----------------others-----------------
;---------------------------------------
;; スタートアップページを表示しない
(setq inhibit-startup-message t)
;;; ツールバーを非表示
;; M-x tool-bar-mode で表示非表示を切り替えられる
;(tool-bar-mode -1)
;; タイトルバーにファイル名表示
(setq frame-title-format (format "%%f - Emacs@%s" (system-name)))
;; タブキー
(setq default-tab-width 4)
(setq indent-line-function 'indent-relative-maybe)
;; 何文字目にいるか表示
(column-number-mode 1)
;; 行カーソル
(defface hlline-face
'((((class color)
(background dark))
;;(:background "dark state gray"))
(:background "gray10"
:underline "gray24"))
(((class color)
(background light))
(:background "gray24"
:underline nil))
(t ()))
"*Face used by hl-line.")
;;(setq hl-line-face 'underline)
(setq hl-line-face 'hlline-face)
(global-hl-line-mode)
;; Emacsのコピペをクリップボードで行う
(defun copy-from-osmarv ()
(shell-command-to-string "pbpaste"))
(defun paste-to-osmarv (text &optional push)
(let ((process-connection-type nil))
(let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
(process-send-string proc text)
(process-send-eof proc))))
(setq interprogram-cut-function 'paste-to-osmarv)
(setq interprogram-paste-function 'copy-from-osmarv)