Infer 在 Mac 上的安装和环境配置

Infer 在 Mac 上的安装和环境配置

 

Infer 介绍

Infer 是一个静态分析工具。Infer 可以分析 Objective-C, Java 或者 C 代码,报告潜在的问题。

任何人都可以使用 Infer 检测应用,这可以将那些严重的 bug 扼杀在发布之前,同时防止应用崩溃和性能低下。

 

Infer 安装

Infer 为 Linux 和 Mac OS 系统提供了预构建的二进制文件,如果你只是想使用 Infer,而不想为该项目贡献代码的话,这些二进制文件足够了。相反,如果你想编译 Infer,请选择源码安装。此文以 Mac 系统为例。

环境要求

Python 版本:大于等于2.7

 

第一种:二进制文件安装

从 infer release 页面获取最新版本 infer-osx-vXX.tar.xz (以osx标识),然后执行下面命令来安装 Infer。

tar xf infer-osx-vXX.tar.xz
# this assumes you use bash, adapt to your needs in case you use
# another shell
echo "export PATH=$PATH:`pwd`/infer-osx/infer/infer/bin" \
     >> ~/.bashrc && source ~/.bashrc

 

第二种:源码安装

借助 brew 安装

1.1 安装 brew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

1.2 安装 Infer

brew install infer

安装达到100% 后可通过 ‘ infer --version ’查看 infer 版本信息

1.3 配置到环境变量

echo "export PATH=\"\$PATH:pwd/infer/infer/bin\"" \ >> ~/.bash_profile &&source ~/.bash_profile

执行完如上操作,如果没报错就成功了。

 

posted @ 2016-09-25 18:05  Coffee_zq  阅读(1420)  评论(0编辑  收藏  举报