MAMP 2.0.1 with Ruby on Rails 3.2.0 on Mac OS X Lion

前端 未结 1 917
情话喂你
情话喂你 2021-01-17 05:08

This has been asked before, but I couldn\'t find a newer result than 2010. A lot can change in two years. The fact that it hasn\'t been asked since, makes me think, that may

1条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-17 05:36

    I found the solution for work with PHP with MAMP 2.0.5 and RAILS with two databases different for each. PHP uses mysql from MAMP and RAILS a other database installed via Homebrew.

    I use mac os lion 10.7.3

    I explain how I did

    1-The first step is delete all. Delete MAMP, MAMP PRO, the folders in applications (be carefully with your projects if they are in the MAMP folder) and all the mysql servers that you have installed. (visit this link for how remove mysql from mac osx lion http://johnmcostaiii.net/2011/removing-mysql-osx-lion/)

    2-Install the lattest version of Xcode (via App Store)

    3-Install homebrew (https://github.com/mxcl/homebrew/wiki/installation)

    4-Install rvm and ruby 1.9.3. Follow the steps of quick start guide (http://beginrescueend.com/)

    5-Open a terminal and install mysql via homebrew

    brew install mysql
    

    Read the installations of mysql notes (on terminal) and follow the steps. (create alias, password, start and initialize database, etc)

    6- Say at rvm that uses the ruby version 1.9.3

    rvm use 1.9.3
    

    7- If you want, you can create a gemsets (explained at rvm webpage) and use it

    rvm gemset create "gemset_name"
    
    use 1.9.3@gemset_name
    

    8- Install rails

    gem install rails
    

    9 - Create a app with mysql gems

    rails new name_app -d mysql
    

    And it works!

    10 - Install MAMP PRO 2.0.5

    11 - Test with any PHP page with database

    And it works!

    (After install and run MAMP, I created a vhosts for try if all work fine, but the vhosts don´t work properly. I spent 1 hour searching a solution, but the solution for me was restart the computer finally ... and ... )

    I hope that help you! I lost many hours looking for the solution

    (I followed this steps with changes: http://www.frederico-araujo.com/2011/07/30/installing-rails-on-os-x-lion-with-homebrew-rvm-and-mysql/)

    edit: everytime you open the console and work with rails you must type in the console

    rvm use 1.9.3@gemset_name
    

    or create a file with this command and save in the folder of your rails app with name

    .rvmrc
    

    0 讨论(0)
提交回复
热议问题