MacOS

2012年10月09日

Mac OS Xを使い始めて、疑問に思っていたこと。
terminalを起動してbashが起動しているのに、.bashrcが反映されない。
改めて調べてみると、bashでの.bashrcは本来の設定場所ではなさそう。
.bash_profileがメインっぽい。

このページがわかりやすい。
http://d.hatena.ne.jp/takuya_1st/20110102/1293970212

ま、.cshrcの頃からの名残で、.bashrcもあるのかなと思いつつ、黙って.bash_profileで.bashrcを読み込む設定を入れた。 

参考にしたのは以下。
http://tstylestudio.com/wp/2010/10/12/158/


sylphide_ffr31mr at 21:54コメント(0)トラックバック(0) 

2012年09月05日

OSXにpythonは入っているが、pipがちゃんと動かない。
homebrewを使って、改めて入れ直すことにする。
OS標準では、/usr/bin/pythonであるが、homebrewは/usr/local/binに入れてくれるので、後でpathを登録する必要がある。

1.HOMEBREWのインストール

 $ruby <(curl -fsSk https://raw.github.com/mxcl/homebrew/go)

インストール後の自己診断

 $ brew doctor
Warning: 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 

macportsが入っているから、消せといわれる。
ま、ディレクトリ名を変えておけばいいだろう。

 $ brew doctor
Your system is raring to brew.  

ちゃんと通った。

2.pythonのインストール

早速インストールをする。

 $ brew install python
Unsatisfied dependency: XQuartz 
Please install the latest version of XQuartz:
  https://xquartz.macosforge.org
Error: An unsatisfied requirement failed this build.  

XQuartzがないと怒られる。
pythonでX11がいるとは、驚きだがしかたない。以下からダウンロードして入れる。

3.XQuartzのインストール

以下らからISOをダウンロードして、インストーラを起動。

http://xquartz.macosforge.org/landing/

4.pipの修正

再度pythonのインストールをトライ。

 $ brew install python 

またエラーが出た。

 ==> Downloading http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/pip-1.1.tar.gz
config.log was copied to /Users/terauchiyasuyuki/Library/Logs/Homebrew
Error: SHA1 mismatch
Expected: 842c4e2aff3f016feea3c6e992c7fa96e49c9aa0
Actual: 3b002db66890880ee776bbe199c3d326d8fe3d6f
Archive: /Library/Caches/Homebrew/pip-1.1.tar.gz
(To retry an incomplete download, remove the file above.) 

pipをダウンロードしたtar.gzが違うという。
いろいろ試行錯誤をしたが、結局、homebrewに登録されているハッシュ値が間違っているという結論。
以下のコマンドで、ハッシュ値を修正する。

 $ brew edit python 

変更前の23行めから26行め。

 23 class Pip < Formula
 24   url 'http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz'
 25   sha1 '842c4e2aff3f016feea3c6e992c7fa96e49c9aa0'
 26 end 

以下のように変更。

 23 class Pip < Formula
 24   url 'http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz'
 25   sha1 '3b002db66890880ee776bbe199c3d326d8fe3d6f'
 26 end 

5.最後、ほんとのpythonインストール

これで再度 $ brew install pythonをすると無事終了した。
PATHを/usr/local/binを優先させて。 

 $ which python
/usr/local/bin/python

$ python --version
Python 2.7.3 


sylphide_ffr31mr at 23:55コメント(0)トラックバック(0) 

2012年07月30日

OS Xでgem installをしようとすると、以下のようなエラーが出てしまう。 調べてみると、gccを入れるとか、Xcodeを最新にするとか、いろいろ対策がでてくる。 入れようとするgemも、mysql関係や、hpricot関係やらと、千差万別だが、エラーメッセージは 同じようだ。

$ sudo gem install evernote
Building native extensions.  This could take a while...
ERROR:  Error installing evernote:
	ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/thrift-0.8.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/thrift-0.8.0/ext/gem_make.out

結論としては、XcodeでCommand line toolsを入れれば、必要なライブラリが入るようだ。 入れ方は、Xcodeを起動して、Xcodeメニューから。

Xcode-->open developer tool-->More developper tool-->safariが開く-->OSに合わせたCommand line toolsをインストール

このインストールが終わると、以下が実行可能となった。

$ sudo gem install evernote
Building native extensions.  This could take a while...
Successfully installed thrift-0.8.0
Successfully installed thrift_client-0.8.1
Successfully installed evernote-1.2.1
3 gems installed
Installing ri documentation for thrift-0.8.0...

Enclosing class/module 'thrift_module' for class BinaryProtocolAccelerated not known

Enclosing class/module 'thrift_module' for class BinaryProtocolAccelerated not known
Installing ri documentation for thrift_client-0.8.1...
Installing ri documentation for evernote-1.2.1...
Installing RDoc documentation for thrift-0.8.0...

Enclosing class/module 'thrift_module' for class BinaryProtocolAccelerated not known

Enclosing class/module 'thrift_module' for class BinaryProtocolAccelerated not known
Installing RDoc documentation for thrift_client-0.8.1...
Installing RDoc documentation for evernote-1.2.1...


sylphide_ffr31mr at 23:33コメント(0)トラックバック(0) 
記事検索
最新コメント
プロフィール

やすき

月別アーカイブ
  • ライブドアブログ