$ sudo npm install -g phonegap
1. 安装brew包管理器
sudo su
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local
$ sudo brew install wget
关于更多brew的信息,可以参考:
a) Mac OS下安装brew工具: http://community.itbbs.cn/thread/19823/
b) brew的官方网站: http://brew.sh/
2. 安装nodejs
$ sudo brew install nodejs
3. 安装Xcode
可以在appstore中搜索安装,免费的!
4. 安装Xcode command line tools,ios SDK以及ios模拟器:
在Xcode菜单栏依次单击“ Preferences” →“ Downloads”,然后再依次单击“Components”,选择相应模块安装
5. 安装phonegap
$ sudo npm install -g phonegap
6. 创建测试App
$ phonegap create hello com.example.hello HelloWorld
7. 编译并运行hello:
$ phonegap build ios
[phonegap] detecting iOS SDK environment...
[phonegap] using the local environment
[phonegap] compiling iOS...
[phonegap] successfully compiled iOS app
$ phonegap install ios
[phonegap] detecting iOS SDK environment...
[phonegap] using the local environment
[phonegap] trying to install app onto device
[phonegap] no device was found
[phonegap] trying to install app onto emulator