カテゴリー : 2012年 2月

[Eclipse] Project を切り替えるときの Java/Tomcat の設定変更メモ

Eclipse のプロジェクトを切り替えのときに Java + Tomcat の設定を変更する箇所をご紹介します。

・[ウィンドウ] → [設定]
  ・[Java] → [インストール済みのJRE] → (該当するJREを選択)

  ・[Tomcat]
    ・[Tomcatバージョン] を該当のものに設定
    ・[Tomcatホーム] にてホームを指定する
    (例)C:Usersyour_usernameDocumentsdevelopmentpleiades-e3.7-ultimate-jretomcat6.0 とか
    ・[JVM設定] → [JRE] を該当のものに設定する

・Project上で右クリック → [プロパティ]
  ・[Javaコンパイラー]
    ・[プロジェクト固有の設定を可能にする]にチェックする

以上です。

[Facebook] Developer/HTML5 Blog や Weekly Platform Updates、Platform Statusなどの情報がメール購読できるようになりました

Facebook の開発者向け情報がメールで購読できるようになったみたいです。

・設定ページ:Settings – Facebook Developers はてなブックマーク - Settings - Facebook Developers
 

メール購読できる情報一覧

・Weekly Platform Updates

Developer Blog はてなブックマーク - Developer Blog - Facebook Developers

HTML5 Blog はてなブックマーク - HTML5 Blog - Facebook Developers

Platform Status はてなブックマーク - Platform Status - Facebook Developers
 

とりあえず、全部チェックを入れてメール購読してみます。
 

[RVM][Ruby] ERROR: Loading command: install (LoadError) cannot load such file — zlib、ERROR: While executing gem … (NameError) uninitialized constant Gem::Commands::InstallCommand

Mac に RVM で Ruby の開発環境を整えて、いざ gem をインストールしようとしたらエラーが発生しました。

■ エラー内容

$ gem install heroku
ERROR:  Loading command: install (LoadError)
    cannot load such file -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand

下記のようなコマンドで Ruby をインストールしたのが原因で zlib への Path が通らなかったみたい。

rvm install 1.9.3 -C \
--with-readline-dir=$rvm_path/usr \
--with-iconv-dir=$rvm_path/usr \
--with-zlib-dir=$rvm_path/usr \
--with-openssl-dir=$rvm_path/usr

-C オプションでPathとか指定せずに、シンプルにインストールすれば上手くいった。

rvm install 1.9.3

原因はちゃんと分かってないけど、とりあえず良しとする。

[Mac] Xcode 4.2 から GNU GCC 4.2 はサポートされていない

Xcode 4.2 から GNU GCC 4.2 はサポートされていないみたいです。

■ Xcode 4.1 以前

GCC 4.2
LLVM GCC 4.2
LLVM Compiler 2.0

■ Xcode 4.2

LLVM GCC 4.2
Apple LLVM Compiler 3.0

・引用元:Xcode 4.2で変わったビルド設定(アーキテクチャとコンパイラ)と問題点などについて – Awaresoft はてなブックマーク - Xcode 4.2で変わったビルド設定(アーキテクチャとコンパイラ)と問題点などについて - Awaresoft

GCC 4.2 がないことを知らずに、色々とハマりました。

皆さん注意して下さいね。

[Mac] Xcode 4.2 から 4.1 へダウングレード(downgrade)する方法

Xcode 4.2 から 4.1 へダウングレードしました。

rvm を使って Ruby 1.9.2 をインストールして、いざ rvm requirements してみると、

“Xcode 4.2.1+ users – please be warned – ”

と出て、無理みたいだったので、Xcode 4.2 から Xcode 4.1 にダウングレードしました。
 

Xcode 4.2 から 4.1 にダウングレードする手順

1. Xcode 4.1のインストーラをダウンロードする

xcode_4.1_for_lion.dmg を Resources for Apple Developer からダウンロードします。

Resources for Apple Developers – Apple Developer

ダウンロードするにはDeveloper登録が必要です、(有料)
 

2. Xcode 4.2 をアンインストールする

下記のコマンドを実行します。

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

3. アプリケーションフォルダ以下の Install Xcode.app を削除

xcode_4.1_for_lion.dmg で、アプリケーションフォルダに Install Xcode.app を作成するために、今あるインストーラー Install Xcode.app を削除します。
 

4. Xcode 4.1 をインストール

xcode_4.1_for_lion.dmg をマウントして、InstallXcodeLion.pkg をダブルクリックして、インストールします。
 

以上です。


参考情報

Xcode4.2から4.1へのダウングレードについて – 実はhokkai7go

How to remove XCode 4.2 and install 4.1 to develop Ruby / Rails on OSX Lion? – Stack Overflow

[RVM][Mac] Error running ‘make ‘, please read ruby-1.9.2-p290/make.log

Mac で RVM を使って Ruby の環境を整えようと思ったら、早々にしてエラーが発生しました。

■ エラー内容

$ rvm install 1.9.2 -C --with-readline-dir=/usr/local
Fetching yaml-0.1.4.tar.gz to /Users/your_username/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/your_username/.rvm/src
Configuring yaml in /Users/your_username/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/your_username/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/your_username/.rvm/usr
Installing Ruby from source to: /Users/your_username/.rvm/rubies/ruby-1.9.2-p290, this may take a while depending on your cpu(s)...
 
ruby-1.9.2-p290 - #fetching 
ruby-1.9.2-p290 - #extracted to /Users/your_username/.rvm/src/ruby-1.9.2-p290 (already extracted)
ruby-1.9.2-p290 - #configuring 
ruby-1.9.2-p290 - #compiling 
Error running 'make ', please read /Users/your_username/.rvm/log/ruby-1.9.2-p290/make.log
There has been an error while running make. Halting the installation.

原因は、Mac OS Lion から gcc が変わって、正常にコンパイルできなかったせいでした。

なので、この記事を参考にして apple-gcc42 をインストールして、 CC=’gcc-4.2′ のように使用する gcc を一時的に変更すればOKです。

[Mac] Homebrew で apple-gcc42 をインストールする方法 | CodeNote.net はてなブックマーク - [Mac] Homebrew で apple-gcc42 をインストールする方法 | CodeNote.net

ちなみに、Lion に Ruby の開発環境を構築したい方はこちらを参考にして下さい。

Mac OS X Lion に RVM で Ruby の開発環境を構築する手順 | CodeNote.net はてなブックマーク - Mac OS X Lion に RVM で Ruby の開発環境を構築する手順 | CodeNote.net

以上です。

【参考】

Mac OS X LionにRuby 1.8.7、Rails 3.0.10をインストールする – モンテカットの開発日記 はてなブックマーク - Mac OS X LionにRuby 1.8.7、Rails 3.0.10をインストールする - モンテカットの開発日記

Mac OS X Lion に RVM で Ruby の開発環境を構築する手順

Mac OS Lion, Xcode4.1 にて、Rubyのバージョン管理ツール RVM を使って Ruby の開発環境を整える手順をご紹介します。
 

apple-gcc42 のインストール

(Xcode4.1以前の方はこの項目をスキップ)

■ 方法その1

まず、Xcode4.2 を使ってる方は、サポートされている gcc が変わったので、従来まで入っていた apple-gcc42 をインストールします。

[Mac] Homebrew で apple-gcc42 をインストールする方法 | CodeNote.net はてなブックマーク - [Mac] Homebrew で apple-gcc42 をインストールする方法 | CodeNote.net

Homebrewをインストールしていない方はこちらを参考にして下さい。

[Mac] Homebrew をインストール | CodeNote.net はてなブックマーク - [Mac] Homebrew をインストール | CodeNote.net
 

■ 方法その2

OSX GCC Installer を使う。

kennethreitz/osx-gcc-installer はてなブックマーク - kennethreitz/osx-gcc-installer
 

RVMのインストール

Rubyのバージョン管理ツール RVM をインストールします。

$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

次に、~/.bash_profile に設定を追加します。

既に作成されていて、設定が書かれていたら特に何もする必要はありません。

$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile

設定後、.bash_profile を再読み込みします。

$ source ~/.bash_profile

 

Readlineなどの必要なライブラリーのインストール

必要に応じてライブラリーをインストールします。

rvm コマンドでインストールする前に一時的に環境変数を変更します。

export ARCHFLAGS="-arch x86_64"
export CC='gcc-4.2'

最低限 readline はインストールするとして、他も必要に応じてインストールします。

rvm pkg install readline
rvm pkg install iconv
rvm pkg install zlib
rvm pkg install openssl

 

Rubyをバージョン指定してインストール

Ruby の 1.9.3 と 1.9.2 と 1.8.7 の安定版をインストールします。

rvm install 1.9.3
rvm install 1.9.2
rvm install 1.8.7

それぞれ、正常にインストールされたか確認します。

$ rvm list
rvm rubies
 
   ruby-1.8.7-p357 [ i686 ]
   ruby-1.9.2-p290 [ x86_64 ]
   ruby-1.9.3-p0 [ x86_64 ]
 
# Default ruby not set. Try 'rvm alias create default <ruby>'.
 
# => - current
# =* - current && default
#  * - default

 

デフォルトの Ruby のバージョンを設定

最後に、デフォルトで使うRubyのバージョンを指定します。

今回は Ruby 1.9.3 をデフォルトにします。

$ rvm use 1.9.3 --default
Using /Users/your_username/.rvm/gems/ruby-1.9.3-p0

ちゃんと設定されたか確認します。

$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.3.0]
 
$ rvm list
 
rvm rubies
 
   ruby-1.8.7-p357 [ i686 ]
   ruby-1.9.2-p290 [ x86_64 ]
=* ruby-1.9.3-p0 [ x86_64 ]
 
# => - current
# =* - current && default
#  * - default

以上です。

RVM で インストール可能な Ruby バージョン一覧

Rubyのバージョン管理ツール RVM で インストール可能な Ruby バージョン一覧は、rvm list known コマンドで確認できます。

$ rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.6-head
[ruby-]1.8.7[-p357]
[ruby-]1.8.7-head
[ruby-]1.9.1-p378
[ruby-]1.9.1[-p431]
[ruby-]1.9.1-head
[ruby-]1.9.2-p180
[ruby-]1.9.2[-p290]
[ruby-]1.9.2-head
[ruby-]1.9.3-preview1
[ruby-]1.9.3-rc1
[ruby-]1.9.3[-p0]
[ruby-]1.9.3-head
ruby-head
 
# GoRuby
goruby
 
# JRuby
jruby-1.2.0
jruby-1.3.1
jruby-1.4.0
jruby-1.6.1
jruby-1.6.2
jruby-1.6.3
jruby-1.6.4
jruby-1.6.5
jruby-1.6.5.1
jruby-[1.6.6]
jruby-head
 
# Rubinius
rbx-1.0.1
rbx-1.1.1
rbx-1.2.3
rbx-1.2.4
rbx[-head]
rbx-2.0.testing
 
# Ruby Enterprise Edition
ree-1.8.6
ree[-1.8.7][-2012.01]
ree-1.8.6-head
ree-1.8.7-head
 
# Kiji
kiji
 
# MagLev
maglev[-head]
maglev-1.0.0
 
# Mac OS X Snow Leopard Or Newer
macruby[-0.10]
macruby-nightly
macruby-head
 
# IronRuby -- Not implemented yet.
ironruby-0.9.3
ironruby-1.0-rc2
ironruby-head

(一覧は 2012年2月8日時点のもの)

めっちゃあるなぁ。Rubyすごい。

[RVM] Rubyバージョン管理システムRVMのアンインストール(uninstall)方法

Rubyのバージョン管理システムRVM(Ruby Version Manager) をアンインストールする方法をご紹介します。

アンインストールはコマンドラインで下記のコマンド、

$ rvm implode

もしくは、

$ rvm seppuku

を実行するだけでOKです。

しかし、アンインストールするためのコマンド名に「切腹(seppuku)」を付けるネーミングセンスには脱帽です。
 

【参考】

[rvm]RVM seppuku して再インストールメモ | milligramme 3cc はてなブックマーク - [rvm]RVM seppuku して再インストールメモ | milligramme 3cc

[rvm]Rubyバージョン管理システムRVM再インストールメモ | milligramme 3cc はてなブックマーク - [rvm]Rubyバージョン管理システムRVM再インストールメモ | milligramme 3cc

[Mac] Homebrew で apple-gcc42 をインストールする方法

Xcode 4.2.1 から gcc が llvmgcc とかいうのに変わってしまい、今までの gcc を使うためには別途インストールしないといけません。

■ llvmgcc

$ gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

そこで、Homebrew で apple-gcc42 をインストールする方法を調べたので、ご紹介します。

まず、デフォルトの Formula には AppleGCC や GNU GCC はないので、github にある非公式Formulaから直接、インストールします。

Homebrew/homebrew-dupes

$ brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
==> Downloading http://r.research.att.com/tools/gcc-42-5666.3-darwin11.pkg
######################################################################## 100.0%
==> Caveats
NOTE:
This formula provides components that were removed from XCode in the 4.2
release. There is no reason to install this formula if you are using a
version of XCode prior to 4.2.
 
This formula contains compilers built from Apple's GCC sources, build
5666.3, available from:
 
  http://opensource.apple.com/tarballs/gcc
 
All compilers have a `-4.2` suffix. A GFortran compiler is also included
and is the exact same version as the compiler provided by the `gfortran`
formula in the main repository.
==> Summary
/usr/local/Cellar/apple-gcc42/4.2.1-5666.3: 106 files, 75M, built in 115 seconds

gcc-4.2 コマンドで apple-gcc42 が使えるようになりました。

$ gcc-4.2 -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /Volumes/Media/Builds/gcc-5666.3/build/obj/src/configure --disable-checking --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++,fortran --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)

以上です。


参考情報

Build gcc 4.6.2 on Mac OS X Lion | Re: no subject