免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3329 | 回复: 1
打印 上一主题 下一主题

在苹果虚拟机上跑 ROR —— Ruby on Rails On Vmware OSX 10.7.3 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-03-02 12:02 |只看该作者 |倒序浏览
在苹果虚拟机上跑 ROR —— Ruby on Rails On Vmware OSX 10.7.3









1 Get Vmware Image:

安装苹果虚拟机的过程就略了。从网上也能直接下载到VMWARE OSX 10.7.2的IMAGE。 在线升级成10.7.3即可。

2 XCODE 4.3  

通过苹果的下载中心下载安装Xcode 4.3。

https://developer.apple.com/xcode/

在这里下载:https://developer.apple.com/downloads/index.action  需要APPLE ID.

注意连 Command Line Tools For Xcode 也一起下了。 ( Preferences > Downloads > Command Line Tools > Install )

关于XCODE 4.3的痛苦经历看这里: http://www.cnblogs.com/likeyu/archive/2012/02/27/2370639.html

另外这个文章,有时间要读下: http://www.programmer.com.cn/9436/

3 homebrew

https://github.com/mxcl/homebrew/wiki/installation

/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"



4 WGET
Mahmood1s-Mac% brew install wget==> Downloading http://ftpmirror.gnu.org/wget/wg ... ################### 100.0%==> ./configure --disable-debug --prefix=/usr/local/Cellar/wget/1.13.4 --sysconf==> make install/usr/local/Cellar/wget/1.13.4: 7 files, 552K, built in 2.1 minutes复制代码


5 oh-my-zsh

Mahmood1s-Mac% curl -L https://github.com/robbyrussell/ ... er/tools/install.sh | sh  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                 Dload  Upload   Total   Spent    Left  Speed  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0100  1485  100  1485    0     0    230      0  0:00:06  0:00:06 --:--:--   864Cloning Oh My Zsh...Cloning into '/Users/mahmood1/.oh-my-zsh'...remote: Counting objects: 3842, done.remote: Compressing objects: 100% (1664/1664), done.remote: Total 3842 (delta 226, reused 3375 (delta 1964)Receiving objects: 100% (3842/3842), 498.80 KiB | 27 KiB/s, done.Resolving deltas: 100% (2268/226, done.Looking for an existing zsh config...Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zshUsing the Oh My Zsh template file and adding it to ~/.zshrcCopying your current PATH and adding it to the end of ~/.zshrc for you.Time to change your default shell to zsh!Changing shell for mahmood1.Password for mahmood1: chsh: no changes made         __                                     __     ____  / /_     ____ ___  __  __   ____  _____/ /_   / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \ / /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / / \____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/                          /____/                        ....is now installed.复制代码
修改MAC OSX 默认的SHELL为zsh

http://www.askdavetaylor.com/how ... m_tcsh_to_bash.html

If you don't want to change the NetInfo database entry for your account, an easier alternative is to go into the Terminal application (Applications -> Utilities -> Terminal) then go to Terminal -> Terminal Preferences and select "Execute this command" and make sure it's the shell you want, as shown here:


6 macvim 编译

这里又有BUG,需要 brew edit macvim 加入 "--with-ruby-command=/usr/bin/ruby",

?args = ["--with-features=huge",         "--with-tlib=ncurses",         "--with-ruby-command=/usr/bin/ruby",         "--enable-multibyte",         "--with-macarchs=#{arch}",         "--enable-perlinterp",         "--enable-pythoninterp",         "--enable-rubyinterp",         "--enable-tclinterp"]

  



另外由于xcode 4.3的原因 还需要设置下xcode的环境变量。

?sudo xcode-select -switch /Applications/Xcode.app



最后终于安装成功(这里ruby是用的系统的ruby,版本是1.8.7的,先凑合这用)  

Mahmood1s-Mac% brew install macvim
==> Downloading https://github.com/b4winckler/macvim/tarball/snapshot-64
File already downloaded in /Users/mahmood1/Library/Caches/Homebrew
==> ./configure --with-features=huge --with-tlib=ncurses --with-ruby-command=/usr/bin/ruby --enable-multibyte --with-macarchs=x86_64 --enable-per
==> cd src/MacVim/icons && make getenvy
==> make
==> Caveats
MacVim.app installed to:
/usr/local/Cellar/macvim/7.3-64

To link the application to a normal Mac OS X location:
brew linkapps
or:
ln -s /usr/local/Cellar/macvim/7.3-64/MacVim.app /Applications
==> Summary
/usr/local/Cellar/macvim/7.3-64: 1733 files, 27M, built in 101 seconds (只用了不到2分钟,真快)



加入系统菜单中:

Mahmood1s-Mac% brew linkapps
Warning: /Users/mahmood1/Applications does not exist, stopping.
Run `mkdir ~/Applications` first.
Mahmood1s-Mac% mkdir ~/Applications
Mahmood1s-Mac% brew linkapps
Linking /usr/local/Cellar/macvim/7.3-64/MacVim.app





8 安装RUBY

这里有个帖子可以参考,不过那个1step 的shell 没有完善,我这里是不行的。http://dreamhead.blogbus.com/logs/194495277.html

以下都是手工输代码。

?{12-02-28 0:54}Mahmood1s-Mac:~ mahmood1% rvm install 1.9.3 --with-gcc=clang .............  {12-02-28 1:07}Mahmood1s-Mac:~ mahmood1% rvm gemset create rails3 'rails3' gemset created (/Users/mahmood1/.rvm/gems/ruby-1.9.3-p125@rails3). {12-02-28 1:08}Mahmood1s-Mac:~ mahmood1% rvm use 1.9.3@rails3Using /Users/mahmood1/.rvm/gems/ruby-1.9.3-p125 with gemset rails3 {12-02-28 1:08}Mahmood1s-Mac:~ mahmood1% rvm use 1.9.3@rails3 --default Using /Users/mahmood1/.rvm/gems/ruby-1.9.3-p125 with gemset rails3

改用淘宝ruby的镜像:

?{12-02-28 1:10}Mahmood1s-Mac:~ mahmood1% gem sources --remove http://rubygems.org/  http://rubygems.org/ removed from sources {12-02-28 1:10}Mahmood1s-Mac:~ mahmood1% gem sources --add http://ruby.taobao.org/   http://ruby.taobao.org/ added to sources {12-02-28 1:11}Mahmood1s-Mac:~ mahmood1%  {12-02-28 1:11}Mahmood1s-Mac:~ mahmood1% gem sources list *** CURRENT SOURCES ***

?http://ruby.taobao.org/

?  

?安装RAILS当前版本。

?{12-02-28 1:11}Mahmood1s-Mac:~ mahmood1% gem install rails bundle therubyracer



9 其他待续。主要是安装传说中的TEXTMATE等编辑器。不过我试了下TEXTMATE后感觉,学习成本过高,因为有VIM基础不如直接用VIM好了。


论坛徽章:
0
2 [报告]
发表于 2012-03-02 12:03 |只看该作者
谢谢分享
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP