Mac Install Software

2023/05/08 Mac 共 6244 字,约 18 分钟
闷骚的程序员

使用 Mac 电脑安装软件时不时遇到问题,我将它们以及对应的解决方案逐渐整理归纳,汇总到这一篇帖子里。

Mac Pro M1

tags: MacPro M1

Command Cli

Install Homebrew

[color=red] 方法一:Homebrew 官网获取安装指令,官网地址:https://brew.sh

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

[color=red] 方法二:安装 brew,终端输入如下命令(百度来的,亲试安装成功):

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

:::warning 备注:一步步按照提示进行操作就可以安装成功使用 brew 命令了. :::

[color=red] brew -h

Example usage:
  brew search TEXT|/REGEX/
  brew info [FORMULA|CASK...]
  brew install FORMULA|CASK...
  brew update
  brew upgrade [FORMULA|CASK...]
  brew uninstall FORMULA|CASK...
  brew list [FORMULA|CASK...]

Troubleshooting:
  brew config
  brew doctor
  brew install --verbose --debug FORMULA|CASK

Contributing:
  brew create URL [--no-fetch]
  brew edit [FORMULA|CASK...]

Further help:
  brew commands
  brew help [COMMAND]
  man brew
  https://docs.brew.sh

Install Htop

brew install htop

Install Iterm2

:::info iTerm2 可以号称 macOS 平台下的第一终端了。相比于自带的终端和 Windows 平台终端,iTerm2 的功能强大到难以想象。官网本身已有非常好的介绍,这里做一个简单的讲解,吸引一下你的眼球。 :::

brew install iterm2
# 具体配置参考官网:https://www.iterm2.com/colorgallery

Install Autojump

brew install autojump

Install Zsh

# 参考文档: https://github.com/ohmyzsh/ohmyzsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# 进入插件目录
cd ~/.oh-my-zsh/plugins
# 下载插件 zsh-syntax-highlighting
git clone git@github.com:zsh-users/zsh-syntax-highlighting.git
# 下载插件 zsh-autosuggestions
git clone git@github.com:zsh-users/zsh-autosuggestions.git

# 编辑配置.zshrc, 找到插件那行配置如下:
vim .zshrc
plugins=(git autojump zsh-syntax-highlighting zsh-autosuggestions)

Config Vim

vim ~/.vimrc

"==========================   基本设置  ========================= "}


" ==========================   代码缩进  ========================= "}


" ==========================   配色方案  ========================= "}!

Install jq

:::info 命令行 JSON 解析器 :::

brew install jq

Install IDE

Install vscode

:::warning 官网链接:https://code.visualstudio.com/ 下载 vscode 的 zip 压缩包解压即可出现 Visual Studio Code 应用, 并把其拖入到应用程序中 :::

# 配置VScode命令行
ln -s /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code  /usr/local/bin/code

Install Lang

Install Golang

step1. 请求官网 https://go.dev/dl/ step2. 下载对应系统版本 pkg,按照提示一步步安装即可

# show version
go version
> go1.19.2 darwin/arm64


# config golang bin path
vi ~/.zshrc
# 新增下面几行命令
export GOPATH=$HOME/go
export PATH=$PATH:${GOPATH//://bin:}/bin
export GOBIN=

Install Rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# show version
rustc -V
> rustc 1.64.0 (a55dd71d5 2022-09-19)

Install Nodejs

https://nodejs.org/en/
download version: 16.17.1 LTS

# show version
/usr/local/bin/node -v
/usr/local/bin/npm -v

# install version manage
npm install -g n

# install nrm
npm install -g nrm

:::success :+1: node、npm 等相关概念 node 和 npm 相关的名词很多,比较容易混淆。 下面对这些名词做个统一梳理

node:一个基于 Chrome V8 引擎的 JavaScript 运行时;提供了 JavaScript 的运行环境。可以直接到 node 官网下载安装

n:node.js 版本管理工具;不同项目可能需要不同版本的 node;可以使用 n 来管理 node.js 版本

npm:node.js 包管理工具;用来管理 node.js 中的第三方插件;新版本的 node 在安装的时候,会自动安装对应版本的 npm

nrm:npm 源的管理工具,可以用来方便的切换 npm 源

cnpm:使用的是淘宝的源。用法跟 npm 完全一致。cnpm 经常会有问题,所以在很多地方不推荐使用

yarn:经过重新设计的崭新的 npm 客户端;运行速度显著提升,整个安装时间比 npm 少。一般推荐使用 yarn 代替 npm

npx:一个 npm 包执行器。我们可以使用 npx 来执行各种命令 :::

Install Typescript

npm i -g typescript
tsc -V
> Version 4.8.4

Install TS-Node

npm i -g ts-node
# 开发环境下可以安装 npm i -g ts-node-dev
ts-node -v
> v10.9.1

Install Python3

brew install python@3.10

Install Tools

Install Docker

https://www.docker.com/ 官网下载对应的版本进行安装

# show version
docker -v
> Docker version 20.10.17, build 100c701

Install Docker-Compose

https://github.com/docker/compose/releases#Assets 官网下载对应的版本安装

cp ~/Downloads/docker-compose-darwin-aarch64 /usr/local/bin/docker-compose

rm -f ~/Downloads/docker-compose-darwin-aarch64

# show version
docker-compose -v
> Docker Compose version v2.11.2

Install Mysql

https://dev.mysql.com/downloads/mysql/ 官网下载对应的版本安装

➜  ~ mysql -uroot -pxxxxxxxx
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.30 MySQL Community Server - GPL

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
mysql> \s
--------------
mysql  Ver 8.0.30 for macos12 on arm64 (MySQL Community Server - GPL)

Connection id:		11
Current database:
Current user:		root@localhost
SSL:			Not in use
Current pager:		less
Using outfile:		''
Using delimiter:	;
Server version:		8.0.30 MySQL Community Server - GPL
Protocol version:	10
Connection:		Localhost via UNIX socket
Server characterset:	utf8mb4
Db     characterset:	utf8mb4
Client characterset:	utf8mb4
Conn.  characterset:	utf8mb4
UNIX socket:		/tmp/mysql.sock
Binary data as:		Hexadecimal
Uptime:			3 min 56 sec

Threads: 2  Questions: 5  Slow queries: 0  Opens: 117  Flush tables: 3  Open tables: 38  Queries per second avg: 0.021

Install PM2

https://pm2.keymetrics.io/docs/usage/quick-start/ 详细用法参考官方文档

npm i -g pm2

# show version
pm2 -V
> 5.2.0

Install Wscat

Connect Remote Websockets

npm i -g wscat

# show version
wscat -V
> 5.2.0

# usage
wscat -c ws://xx.x.x.x

# command cli
wscat -h

> Usage: wscat [options] (--listen <port> | --connect <url>)
Options:
  -V, --version                       output the version number
  --auth <username:password>          add basic HTTP authentication header (--connect only)
  --ca <ca>                           specify a Certificate Authority (--connect only)
  --cert <cert>                       specify a Client SSL Certificate (--connect only)
  --host <host>                       optional host
  --key <key>                         specify a Client SSL Certificate's key (--connect only)
  --max-redirects [num]               maximum number of redirects allowed (--connect only) (default: 10)
  --no-color                          run without color
  --passphrase [passphrase]           specify a Client SSL Certificate Key's passphrase (--connect only). If you don't provide a value, it will be prompted for
  --proxy <[protocol://]host[:port]>  connect via a proxy. Proxy must support CONNECT method
  --slash                             enable slash commands for control frames (/ping [data], /pong [data], /close [code [, reason]])
  -c, --connect <url>                 connect to a WebSocket server
  -H, --header <header:value>         set an HTTP header. Repeat to set multiple (--connect only) (default: [])
  -L, --location                      follow redirects (--connect only)
  -l, --listen <port>                 listen on port
  -n, --no-check                      do not check for unauthorized certificates
  -o, --origin <origin>               optional origin
  -p, --protocol <version>            optional protocol version
  -P, --show-ping-pong                print a notification when a ping or pong is received
  -s, --subprotocol <protocol>        optional subprotocol (default: [])
  -w, --wait <seconds>                wait given seconds after executing command
  -x, --execute <command>             execute command after connecting
  -h, --help                          display help for command

Install grpcurl

参考链接: https://github.com/fullstorydev/grpcurl

brew install grpcurl

文档信息

Search

    Table of Contents