• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

在苹果虚拟机上跑 ROR —— Ruby on Rails On Vmware OSX 10.7.3

原作者: [db:作者] 来自: [db:来源] 收藏 邀请


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/wget-1.13.4.tar.bz2

######################################################################## 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/oh-my-zsh/raw/master/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 --:--:-- 0

100 1485 100 1485 0 0 230 0 0:00:06 0:00:06 --:--:-- 864
Cloning 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 2268), reused 3375 (delta 1964)
Receiving objects: 100% (3842/3842), 498.80 KiB | 27 KiB/s, done.
Resolving deltas: 100% (2268/2268), done.
Looking for an existing zsh config...
Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh
Using the Oh My Zsh template file and adding it to ~/.zshrc
Copying 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_do_i_change_my_default_shell_in_mac_os_x_panther_from_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@rails3
Using /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人参与评论

请发表评论

全部评论

专题导读
上一篇:
Web自动化测试框架Watir(基于Ruby)-第1章Windows下安装与部署发布时间:2022-07-13
下一篇:
rubyonrailsMac安装发布时间:2022-07-13
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap