【iOS】全新Mac机搭建Appium环境(需要的各种工具顺便一块装上)

  • MacBookPro 10.15.7
  • Xcode 11.7
拿到了一台全新的电脑,
准备安装以下工具:
homebrew
Command Line Tools
wget
pod
iTerm
zsh & oh-my-zsh
nodejs
appium
1、安装 homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

出现报错:

==> /usr/bin/sudo /usr/sbin/softwareupdate -i Command\ Line\ Tools\ (macOS\ Mojave\ version\ 10.14)\ for\ Xcode-10.3
Software Update Tool
Downloading Command Line Tools (macOS Mojave version 10.14) for Xcode
Error downloading Command Line Tools (macOS Mojave version 10.14) for Xcode: 网络连接已中断。
Done.
Error downloading updates.
==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
==> /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools'
Failed during: /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools

缺少 Command Line Tools ,那就安装吧

2、安装 Command Line Tools

2种安装方式:
(1)xcode-select --install(依赖xcode)
(2)下载 Command Line Tools.dmg 安装

目前新电脑么有 Xcode,就选择 dmg 方式安装,
安装完成,输入:gcc -v 验证

~ tf3$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
~ tf3$ 

安装完成✅

  • 继续安装 homebrew

又有报错:

==> Downloading and installing Homebrew...
remote: Enumerating objects: 59, done.
remote: Counting objects: 100% (59/59), done.
remote: Compressing objects: 100% (59/59), done.
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 60
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Failed during: git fetch origin --force

解决:
换成中科大镜像-重新安装:

 /usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"

检查一下,

~ tf3$ brew -v
Homebrew 2.5.8

安装完成,yeah✅

3、安装 wget
brew install wget
4、安装 pod
sudo gem install cocoapods
5、安装 iTerm

iTerm官网下载

6、安装 zsh& oh-my-zsh
  • 安装 zsh
brew install zsh
  • 修改默认 shell
chsh -s /bin/zsh
  • 安装 oh-my-zsh
wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh

关闭 iTerm 重新打开✅

7、安装 nodejs

2 种安装方式:
(1)brew install node
(2)下载node pkg包,安装(推荐)

推荐使用第二种方式,就,软件包安装向来问题少。
但我这次是用第一种:brew install node
(๑•́ ₃ •̀๑)

brew install node

安装完成,检查下:

~ tf3$ node -v
v15.1.0
~ tf3$ npm -v
7.0.8
8、安装 appium
npm install -g appium

出现报错:

891 error code ENOENT
892 error syscall chmod
893 error path /usr/local/lib/node_modules/appium/build/lib/main.js
894 error errno -2
895 error enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/appium/build/lib/main.js'
896 error enoent This is related to npm not being able to find a file.
897 verbose exit -2

折腾了一顿,还是搞不定,于是决定换源。

安装 cnpm

# 换 taobao 镜像
npm config set registry https://registry.npm.taobao.org
# 查看是否切换成功
npm config get registry

检查是否安装成功:

cnpm -v

现在,就可以用 cnpm 代替 npm 啦

再次安装 appium:

cnpm install -g appium

完成✅yeah

其实还在 ubuntu 上搭了套环境,当时问题更多,全都记到小本本上,but 小本本没了,算辽

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值