iOS记录篇

安装xcode和ios模拟器的终极大招

2015-11-18  本文已影响1126人  sprint

如果使用AppStore安装xcode你一定遇到过 即将下载完成时 突然失败,然后又重新下载o(╯□╰)o,妈蛋的真的很恼火,然后你屁颠屁颠的再次重试安装,悲剧依然发生...我也是醉了...
那么我们该怎么办???
怎么办?
怎么办?
重要的事....

其实我们可以通过命令行的形式安装xcode及模拟器。

首先你需要有 gem 如果没用过请自行面壁.

1, 安装 xcode-install

 gem install xcode-install

如果提示:

 You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

需要使用sudo获取管理员权限

  sudo gem install xcode-install

2, xcode-install 介绍

xcode-install安装完成后就可以使用xcversion来安装xcode和模拟器了 它的常用命令如下:
+ cleanup Cleanup cached downloads.
+ install Install a specific version of Xcode.
+ install-cli-tools Installs Xcode Command Line Tools.
+ installed List installed Xcodes.
+ list List Xcodes available for download.
+ select Select installed Xcode via xcode-select.
+ selected Show version number of currently selected Xcode.
+ simulators List or install iOS simulators.
+ uninstall Uninstall a specific version of Xcode.
+ update Update cached list of available Xcodes.

3, xcversion使用

如果你想查看可安装的xcode版本,可以通过如下命令:

  $ xcversion list
  7
  7.0.1
  7.1
  7.1.1
  7.2 beta 3

需要提醒你的是如果你首次使用xcversion中的命令需要输入你的开发者账号及密码
下面我们安装 xcode 7.1.1:

$ xcversion install 7.1.1
####################################### ####################               82.1%
 ######################################################################## 100.0%
  Please authenticate for Xcode installation...

上面是安装xcode的方法,接下来是如何安装模拟器,
xcversion simulators是列出可以安装的模拟器版本:

 $ xcversion simulators
 Xcode 6.4.0 (/Applications/Xcode.app)
iOS 7.1 Simulator (installed)
iOS 8.1 Simulator (not installed)
iOS 8.2 Simulator (not installed)
iOS 8.3 Simulator (installed)
Xcode 7.0.0 (/Applications/Xcode-beta.app)
iOS 8.1 Simulator (not installed)
iOS 8.2 Simulator (not installed)
iOS 8.3 Simulator (installed)
iOS 8.4 Simulator (installed)

接着我们安装需要的模拟器:

$ xcversion simulators --install=8.4
####################################### ####################               82.1%
######################################################################## 100.0%
Please authenticate to install iOS 8.4 Simulator...
Successfully installed iOS 8.4 Simulator

OK,基本就是这样子~~~~

模拟器安装方法有更新 详见:https://github.com/KrauseFx/xcode-install/issues/98

欢迎关注个人公众号:DevTipss

微信公众号:DevTipss
上一篇 下一篇

猜你喜欢

热点阅读