2012年5月19日土曜日

memo

memo

"base
set nocompatible
set vb t_vb=

"search
set history=100

"color
colorscheme darkblue
syntax on

"display
set title
set number
set ruler
set showcmd
set laststatus=2
set hlsearch
set wildmenu
set textwidth=0
set tabstop=4
set shiftwidth=4

"encode
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,euc-jp,cp932,iso-2022-jp
set fileencodings+=,ucs-2le,ucs-2,utf-8

autocmd BufWrite *.php :call PHPLint()
function PHPLint()
        let result = system( &ft . ' -l ' . bufname(""))
        echo result
endfunction

2012年5月5日土曜日

Homebrewを使ってみた

Home brewを使ってみた

MacPortsと比べて依存関係でインストールされるソフトが少ないためか、パッケージ管理にHomebrewを使う人が増えているそうです。

MacPortsは、Macに最初から入っているソフトを無視してパッケージが依存するソフトを新規でインストールするという性質を持っていますが、Homebrewは極力Macに入っているものを使うように作られています。

このため、パッケージ導入時のシステムへの負担や、インストールにかかる時間が比較的少なくて済みます。

また、スーパーユーザー(sudo)でコマンドを実行する必要が無く、一般ユーザー権限で使うことが出来ます。

■インストール

■コマンド
$ brew doctor 
インストールされたか確認する、ちゃんとインストールされていないと、Errorがでる


$ brew -v
brewのバージョンを確認


$ man brew

ESSENTIAL COMMANDS (基本的なコマンド)

$ brew install パッケージ名

$brew remove パッケージ名

$ brew update
brew を最新版にする。バージョン管理にgitを使ってるので、入れておく

$ brew list
インストール済みを一覧表示

$ brew search 検索したいパッケージの文字列

基本こんだけ。

■インストールしてみる

$ brew install tree
treeコマンドをインストール

$ brew install wget
wgetコマンドをインストール



■用語解説
Homebrewではパッケージのことを「formula」、パッケージがインストールされる場所を「cellar」と言います。ちなみに日本語に訳すと以下のようになります。


Homebrew(ホームブリュー): 自家醸造酒、自家製ビール
formula(フォーミュラ): 調理法、製法
cellar(セラー):(食料、燃料、ワインの)地下貯蔵庫

macports更新とhomebrewインストール

Macports と homebrew

■概要


構築場所→Mac OS X Lion 10.7.3


■mac ports をアップデート


sudo port selfupdate


↑のコマンドを実行したんだけど、エラーがでるので


downloads for apple developer


↑でCommand Line Tools for Xcodeってのをダウンロードしてインストールしたら
mac ports 関連のがはいってて




sudo port selfupdate
sudo port sync


できました。

■homebrewのインストール

1. 古いXcodeのアンインストール
Xcode3系が入っていたので、アンインストールする。

$ sudo /Developer/Library/uninstall-devtools --mode=all


2.  新しいXcodeをインストール
downloads for apple developer
ダウンロードしてきて
/Applications/Xcode.app
を実行してインストールする。

3. homebrewをインストール
上記のgithubに記述されているように下記のコマンドをターミナルで叩く


/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"


4. homebrewがちゃんとインストールされているかチェック


$ brew doctor
Error: /Library/Frameworks/Mono.framework detected
This can be picked up by CMake's build system and likely cause the build to
fail. You may need to move this file out of the way to compile CMake. 
→ とりえあず、Mono.frameworkでぐぐる
http://www.mono-project.com/Mono:OSX
ここに書いてる


#!/bin/sh -x

#This script removes Mono from an OS X System.  It must be run as root

rm -r /Library/Frameworks/Mono.framework

rm -r /Library/Receipts/MonoFramework-*

for dir in /usr/bin /usr/share/man/man1 /usr/share/man/man3 /usr/share/man/man5; do
   (cd ${dir};
    for i in `ls -al | grep /Library/Frameworks/Mono.framework/ | awk '{print $9}'`; do
      rm ${i}
    done);
done
これを ~/bin/ に
vim uninstall_mono_mac.sh に書いて実行して消してみる


Error: You have Macports or Fink installed.
This can cause trouble. You don't have to uninstall them, but you may like to
try temporarily moving them away, eg. 
sudo mv /opt/local ~/macports 
→ sudo mv /opt/loacal ~/macportsを実行しろっていってる見たいなので実行


Error: Your pkg-config is not checking "/usr/X11/lib/pkgconfig" for packages.
Earlier versions of the pkg-config formula did not add this path
to the search path, which means that other formula may not be able
to find certain dependencies.


To resolve this issue, re-brew pkg-config with:
  brew rm pkg-config && brew install pkg-config
Error: You have a non-brew 'pkg-config' in your PATH:
  /opt/local/bin/pkg-config


`./configure` may have problems finding brew-installed packages using
this other pkg-config.
→ここはわからないけど、Mono消したらなくなった。


Error: Your Xcode is configured with an invalid path.
You should change it to the correct path. Please note that there is no correct
path at this time if you have *only* installed the Command Line Tools for Xcode.
If your Xcode is pre-4.3 or you installed the whole of Xcode 4.3 then one of
these is (probably) what you want:


    sudo xcode-select -switch /Developer
    sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer


DO NOT SET / OR EVERYTHING BREAKS!


→ ここは二つのsudoのコマンドをそのまま実行で消えた




yanap@~$brew doctor
Your system is raring to brew. → このメッセージがでたらパッケージをインストールできる状態みたいです。