Configure Ruby on Rails and git on your Mac

Source: Internet
Author: User
Tags install homebrew install openssl ruby on rails


Ruby on Rails on Mac
======================================================== ====================================
http://morizyun.github.io/blog/marvericks-rails-setup-ruby-rvm-msyql/
for general: useful: http://qiita.com/keneo/items/0a58b188183b5100e3af
for mysql: http://qiita.com/hkusu/items/cda3e8461e7a46ecf25d
http://dev.classmethod.jp/server-side/language/build-ruby-environment-by-rbenv/
1. Install Homebrew
$ ruby -e "$ (curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. Install rbenv
$ brew install ruby-build
$ brew install rbenv
Set path
$ echo 'export PATH = "$ HOME / .rbenv / bin: $ PATH"' >> .bash_profile
$ echo 'eval "$ (rbenv init-)"' >> .bash_profile
$ source .bash_profile
3. Install possible tools and packages
3.1 install sublime and configure open sublime with command line
https://gist.github.com/olivierlacan/1195304
After installing sublime, create a shortcut to it under / usr / local / bin so that you can execute subl anywhere to start sublime
$ ln -s / Applications / Sublime \ Text \ 2.app/Contents/SharedSupport/bin/subl / usr / local / bin / sub
3.2 Install git
$ rew install git
3.3 packages using irb (interactive ruby)
$ brew install readline
3.4 Install packages using https
$ brew install openssl
4. install ruby
$ rbenv install -l determine which ruby can be installed
$ rbenv install 2.1.4 Install the version you want to use
$ rbenv global 2.1.4 Set the version used, if not set, you may see other versions directly by ruby -v
$ rbenv versions confirmed
$ ruby -v shows ruby 2.1.4p265 (2014-10-27 revision 48166) [x86_64-darwin14.0]
5. Install rails
$ gem install rails
$ gem install bundler
$ rbenv rehash
$ source ~ / .bash_profile
$ rails -v shows rails 4.2.1
6. Install MySql
$ brew update
$ brew install mysql
$ brew infö mysql confirm, you can also mysql —version only look at the version number
7. Start rails
$ rails server
Open http: // localhost: 3000 to confirm success
Ctrl + c to exit
8. Use MySql
$ mysql.server start
$ mysql -uroot has no password by default. If you want to set a password, execute the following statement
$ mysql_secure_installation
$ mysql -uroot -p with password
mysql> exit exit
$ mysql.server stop
9. After starting the computer for the second time, running rails -v prompts that it is not installed. Running ruby -v shows 2.0.0. After executing rbenv global 2.1.4, it remains unchanged. Execute at this time
$ echo 'eval "$ (rbenv init-)"' >> ~ / .bash_profile (write rbenv's initialization script to the file) (if the permissions are insufficient, modify the owner of the file to be the user)
$ source ~ / .bash_profile (execute the file)
Then execute ruby -v rails -v.
10. Develop Ruby on Rails
http://openbook4.me/projects/92
11. Create project and upload to github
$ git config --global user.name "ユ ー ザ ー 名"
$ git config --global user.email [email protected]
$ git config --global core.editor "subl -w" // Configuration editor, here is subl
$ subl ~ / .netrc Append the following // If not executed, you need to enter username and password each time you push
machine github.com
login USERNAME
password PASSWORD

$ rails new larry-twitter // Create app
$ cd larry-twitter
$ git init // will create a git repo in the app directory, larry-twitter
$ git add.
$ git commit -m "Initialize repository"
Create a repository on github and get https
$ git remote add origin https://github.com/yangpeng-chn/larry-twitter.git
$ git push -u origin master
======================================================== ==================================== 


Configure Ruby on Rails and git on your Mac


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.