Ruby on Rails 2.3 をMacOSXにインストール

RoR  Add comments
hatena Ruby on Rails 2.3 をMacOSXにインストール
 Ruby on Rails 2.3 をMacOSXにインストール
facebook Ruby on Rails 2.3 をMacOSXにインストール
google buzz Ruby on Rails 2.3 をMacOSXにインストール
yahoo Ruby on Rails 2.3 をMacOSXにインストール
livedoor Ruby on Rails 2.3 をMacOSXにインストール
 Ruby on Rails 2.3 をMacOSXにインストール
friendfeed Ruby on Rails 2.3 をMacOSXにインストール

さて、我が家のMac book proのHDDが飛んだ為にrailsを再インストール/アップデートした際のメモ。
Mac OSX 10.5.6でのお話。

まずはgem本体をupdate

$ sudo gem update --system

インストールされている全てをupdate

$ sudo gem update

次にMySQLをインストール。MAMPと迷った物の若干更新が遅いようなのでMySQL.comよりMac用MySQLserverをDL。
が、罠が。まず一つ目。
なにも考えずMac OS X 10.5 (x86_64)をダウントードしたのですが、まぁなんだかんだでエラーが出ます。
特に理由が無ければMac OS X 10.5 (x86)を使いましょう。
Mac OS X 10.5 (x86)

二つ目の罠。
意気揚々とrake db:migrateとするもののエラー。

$ db:migrate
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!If I run gems list it does not show mysql, so I tried to run the gem install and got the following:ERROR: Error installing mysql:ERROR: Failed to build gem native extension./System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no

rails 2.2?からMySQLのドライバーを別途インストールする必要があるとの事。はぁ。

$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

とりあえず。rails2.3でsampleを動かさねばと、せっかくMySQLを入れたので、MySQLで行きます。

$ rails bookmark -d mysql
create
create  app/controllers
create  app/helpers
create  app/models
create  app/views/layouts
create  config/environments
create  config/initializers
create  config/locales
create  db
create  doc
create  lib
create  lib/tasks
create  log
create  public/images
create  public/javascripts
create  public/stylesheets
create  script/performance
create  test/fixtures
create  test/functional
create  test/integration
create  test/performance
create  test/unit
create  vendor
create  vendor/plugins
create  tmp/sessions
create  tmp/sockets
create  tmp/cache
create  tmp/pids
create  Rakefile
create  README
create  app/controllers/application_controller.rb
create  app/helpers/application_helper.rb
create  config/database.yml
create  config/routes.rb
create  config/locales/en.yml
create  config/initializers/backtrace_silencers.rb
create  config/initializers/inflections.rb
create  config/initializers/mime_types.rb
create  config/initializers/new_rails_defaults.rb
create  config/initializers/session_store.rb
create  config/environment.rb
create  config/boot.rb
create  config/environments/production.rb
create  config/environments/development.rb
create  config/environments/test.rb
create  script/about
create  script/console
create  script/dbconsole
create  script/destroy
create  script/generate
create  script/runner
create  script/server
create  script/plugin
create  script/performance/benchmarker
create  script/performance/profiler
create  test/test_helper.rb
create  test/performance/browsing_test.rb
create  public/404.html
create  public/422.html
create  public/500.html
create  public/index.html
create  public/favicon.ico
create  public/robots.txt
create  public/images/rails.png
create  public/javascripts/prototype.js
create  public/javascripts/effects.js
create  public/javascripts/dragdrop.js
create  public/javascripts/controls.js
create  public/javascripts/application.js
create  doc/README_FOR_APP
create  log/server.log
create  log/production.log
create  log/development.log
create  log/test.log
$ cd Bookmark

はいはい、サクサクとフィールドを追加。

$ script/generate scaffold bookmark name:string url:string
exists  app/models/
exists  app/controllers/
exists  app/helpers/
create  app/views/bookmarks
exists  app/views/layouts/
exists  test/functional/
exists  test/unit/
create  test/unit/helpers/
exists  public/stylesheets/
create  app/views/bookmarks/index.html.erb
create  app/views/bookmarks/show.html.erb
create  app/views/bookmarks/new.html.erb
create  app/views/bookmarks/edit.html.erb
create  app/views/layouts/bookmarks.html.erb
create  public/stylesheets/scaffold.css
create  app/controllers/bookmarks_controller.rb
create  test/functional/bookmarks_controller_test.rb
create  app/helpers/bookmarks_helper.rb
create  test/unit/helpers/bookmarks_helper_test.rb
route  map.resources :bookmarks
dependency  model
exists    app/models/
exists    test/unit/
exists    test/fixtures/
create    app/models/bookmark.rb
create    test/unit/bookmark_test.rb
create    test/fixtures/bookmarks.yml
create    db/migrate
create    db/migrate/XXXXXXXXXX_create_bookmarks.rb

次に「bookmark_development」というDBを作成して。

$ rake db:migrate
(in /Users/XXXXXXX/Sites/bookmark)
==  CreateBookmarks: migrating ================================================
-- create_table(:bookmarks)
-> 0.0893s
==  CreateBookmarks: migrated (0.0896s) =======================================

起動です。

$ script/server

http://localhost:3000/bookmarksを確認して終了。
おつかれさまでした。

関連記事

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS