2012-02-01 2 views
1

레일, mysql2 gem 및 mysql을 설치했으며 rails new simple_cms -d mysql을 사용하여 simple_cms 프로젝트를 만들었습니다. 내가 WEBricks을 시작 rails server을 실행할 때 지금, 나는 기쁨의 버킷을 얻을 :rails server 명령으로 라이브러리를 찾을 수 없습니다.

/Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/mysql/lib/libmysqlclient.16.dylib (LoadError) 
    Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle 
    Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle 
    from /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2.rb:9 
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require' 
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require' 
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each' 
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `require' 
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each' 
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require' 
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler.rb:122:in `require' 
    from /Users/tyre77/Dropbox/Broetry In Motion/RailsTestApp/simple_cms/config/application.rb:7 
    from /Library/Ruby/Gems/1.8/gems/railties-3.2.1/lib/rails/commands.rb:53:in `require' 
    from /Library/Ruby/Gems/1.8/gems/railties-3.2.1/lib/rails/commands.rb:53 
    from /Library/Ruby/Gems/1.8/gems/railties-3.2.1/lib/rails/commands.rb:50:in `tap' 
    from /Library/Ruby/Gems/1.8/gems/railties-3.2.1/lib/rails/commands.rb:50 
    from script/rails:6:in `require' 
    from script/rails:6 

I는 다음과 같이 내 .bash_profile에 변경되었습니다 (관련 있는지 확실하지 않습니다)를

PS1="\u \w$ " 
alias ll="ls -lahG" 

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/$PATH" 


# include .bashrc if it exists 
if [ -f $HOME/.bashrc ]; then 
    . $HOME/.bashrc 
fi 

# startup virtualenv-burrito 
if [ -f $HOME/.venvburrito/startup.sh ]; then 
    . $HOME/.venvburrito/startup.sh 
fi 

참조 : Unable to start rails server하지만 내 MySQL 버전이 다르며 0.2.6에서 0.3.11까지 변경해도 문제가 해결되지 않습니다

+0

MySQL을 어떻게 설치 했습니까? 또한 RVM 또는 rbenv 대신 Apple의 Ruby를 사용하는 이유는 무엇입니까? –

+0

@ MaurícioLinhares dev.mysql.com을 통해 설치하고 DMG를 사용했습니다. – Chris

+0

@ MaurícioLinhares 왜 Ruby를 사용하지 않았습니까? – Chris

답변

2

문제는 Ruby가 MySQL 보석을 만드는 데 필요한 라이브러리를 찾을 수 없다는 것입니다. 이 문제를 해결하기 위해 sinc e 루비를 시작한 것처럼 보입니다. 환경을 준비 할 가치가 있다고 생각합니다. 다음 단계는 다음과 같습니다.

먼저 Homebrew을 설치하는 것이 좋습니다. Homebrew가 설치된 상태에서 MySQL을 설치하십시오 :

brew install mysql 

이것은 필요할 때 MySQL 라이브러리를 포함하여 컴퓨터에 MySQL을 설치합니다.

다음은 루비를 설치하기 위해 RVM을 설치해야합니다. RVM을 설치하기 전에 brew install git을 실행해야합니다. RVM을 설치하면 원하는 루비를 설치할 수 있습니다.

그리고 나서, 루비에 내장 된 것을 사용할 수없는 이유는 무엇입니까? Rails는 4.0의 Ruby 1.8. * 지원을 중단하고 커뮤니티는 일반적으로 RVM (또는 rbenv)을 사용하여 컴퓨터에 설치된 루비를 설치하고 관리합니다.

+0

굉장! Virtualb 같은 자작 나무가 있습니까? 그리고 이미 mysql DMG를 다운로드했다면 다시해야할까요? (tar가 필요한 것 같습니다)? – Chris

+0

설치 한 MySQL을 완전히 제거하고 homebrew와 함께 설치하십시오. ** RVM **은 virtualenv에 가깝습니다. –

관련 문제