一、简介
Alcatraz 是一款 Xcode的插件管理工具,可以用来管理XCode的插件、模版以及颜色配置等。而适当地用一些插件,可以提供开发效率。
二、安装
这里得做一个区分,针对Xcode 8+以及低于Xcode 8的版本。
1、低于 Xcode 8版本的安装方法
1)、先卸载之前安装过的以及清除掉之前缓存的
$ rm -rf ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin
$ rm -rf ~/Library/Application\ Support/Alcatraz/
2)、开始安装
这里有两个方法
方法一:
1、终端输入命令
$ curl -fsSL https://raw.github.com/alcatraz/Alcatraz/master/Scripts/install.sh | sh
2、查看插件安装目录 ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins

方法二:
1、前往Alcatraz的github地址 https://github.com/alcatraz/Alcatraz,下载
2、直接运行工程

3、查看插件安装目录 ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins

3)、使用
1、退出Xcode,直接按command + Q
2、重新打开Xcode,会出现提示框,点击Load Bundle

3、点击window -> Package Manager, 搜索相应插件,安装后退出Xcode,重启Xcode,出现操作2中的提示框,点击Load Bundle后即可使用。

2、Xcode 8+版本的安装方法
这里有个很大的区别,按照以上方法安装后,在window目录下并没有Package Manager选项

分析:没有将当前Xcdoe版本的UUID赋值给插件,导致插件无法识别当前Xcode
解决方法:

也可以用以下指令直接操作
1、获取DVTPlugInCompatibilityUUID
$ defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID

2、将DVTPlugInCompatibilityUUID添加到插件里
$ find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add ************(第一步获取的DVTPlugInCompatibilityUUID)

然而,并没有啥卵用--__--||

分析:估计是Xcode 8+后对插件管理做了一些处理,经过一番搜索,终于找到了一个有用的信息:Xcode 8开始对于Alcatraz中安装的插件已经不支持,但是苹果推出了自己的扩展,也就是Xcode 8 中提供了开发插件的扩展
因此得执行以下操作
1、安装
$ sudo gem install update_xcode_plugins

2、查看
$ update_xcode_plugins

3、修复, 会对Xcode执行去除签名验证的操作,对于后期打包上传AppStore可能有影响,因此可以自己先手动备份一个Xcode,用备份的Xcode来试验。
$ update_xcode_plugins —unsign
($ update_xcode_plugins —restore ) 重置,会将之前去除签名验证的Xcode重新获取签名验证。

然后重新打开执行过unsign的那个Xcode

安装到一半,报错

出现此问题是因为我是用备份的Xcode来测试,执行unsigned操作,但是在这之前,没将备份的Xcode的UUID添加到插件里面,因此无法识别,解决方法就是按照以上操作,将备份Xcode的UUID添加到插件里面。

然后又出现这个问题,估计是在前面已经执行过安装Alcatraz的操作,本地有缓存

执行命令,卸载
$ rm -rf ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin
$ rm -rf ~/Library/Application\ Support/Alcatraz/
重装
$ curl -fsSL
https://raw.github.com/alcatraz/Alcatraz/master/Scripts/install.sh
| sh
$ sudo gem install update_xcode_plugins
$ update_xcode_plugins
$ update_xcode_plugins —unsign