Mac 系统软件包管理工具 https://github.com/Homebrew/brew
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
brew | 源代码仓库 |
homebrew-core | 核心源 |
homebrew-cask | macOS应用和大型二进制程序安装 |
homebrew-bottles | 预编译二进制软件包 |
brew --version
which $SHELL
vim .zshrc
export HOMEBREW_NO_INSTALL_FROM_API=1 # brew 4.0后 仍使用core和 cask
echo '
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
export HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/bottles"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
' >> ~/.zshrc
# 显示 Homebrew 本地的 Git 仓库
$ brew --repo
# 显示 Homebrew 安装路径
$ brew --prefix
# 显示 Homebrew Cellar 路径
$ brew --cellar
# 显示 Homebrew Caskroom 路径
$ brew --caskroom
# 缓存路径
$ brew --cache
# 查看当前已经安装的服务
brew services list
0.1. brew install mysql-client
mysql-client is keg-only, which means it was not symlinked into /opt/homebrew,
because it conflicts with mysql (which contains client libraries).
If you need to have mysql-client first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"' >> ~/.zshrc
For compilers to find mysql-client you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/mysql-client/lib"
export CPPFLAGS="-I/opt/homebrew/opt/mysql-client/include"
For pkg-config to find mysql-client you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/mysql-client/lib/pkgconfig"
0.2. brew install redis
➜ Desktop brew install redis
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/redis-6.2.6.arm64_monterey.bottle.tar.gz
######################################################################## 100.0%
==> Pouring redis-6.2.6.arm64_monterey.bottle.tar.gz
==> Caveats
To restart redis after an upgrade:
brew services restart redis
Or, if you don not want/need a background service you can just run:
/opt/homebrew/opt/redis/bin/redis-server /opt/homebrew/etc/redis.conf
==> Summary
14 files, 2MB
==> Running `brew cleanup redis`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
0.3. brew search maven
brew install [email protected]
问题1:
brew install [email protected] Error: [email protected] has been disabled because it is not maintained upstream!
解决方法:
执行以下指令
brew edit [email protected]
将文件里这一行删去:
disable! date: “2022-07-31”, because: :unmaintained
echo ‘export PATH=“/opt/homebrew/opt/[email protected]/bin:$PATH”’ >> ~/.zshrc
(base) ➜ ~ mvn -v
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-18T02:33:14+08:00)
Maven home: /opt/homebrew/Cellar/[email protected]/3.5.4_1/libexec
Java version: 17.0.6, vendor: Oracle Corporation, runtime: /Users/dcq/.sdkman/candidates/java/17.0.6-oracle
Default locale: en_US, platform encoding: UTF-8
OS name: “mac os x”, version: “13.4.1”, arch: “x86_64”, family: “mac”
修改配置文件
cd /usr/local/Cellar/[email protected]/3.5.4_1/libexec
vim conf/settings.xml
修改本地仓库
修改国内镜像
最后在IDEA上配置使用本地的Maven
1. 安装MySQL
brew install mysql
We have installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -u root
To start mysql now and restart at login:
brew services start mysql
Or, if you don not want/need a background service you can just run:
/opt/homebrew/opt/mysql/bin/mysqld_safe --datadir\=/opt/homebrew/var/mysql
==> Summary
🍺 /opt/homebrew/Cellar/mysql/8.1.0: 325 files, 311.2MB
==> Running `brew cleanup mysql`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> mysql
We have installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -u root
To start mysql now and restart at login:
brew services start mysql
Or, if you don not want/need a background service you can just run:
/opt/homebrew/opt/mysql/bin/mysqld_safe --datadir\=/opt/homebrew/var/mysql
# 启动服务
brew services start mysql
# 更新密码: [email protected]
mysql_secure_installation
brew services stop mysql
2. 安装PG
brew services start postgresql
3. 安装Rust环境
基本安装
$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
$ xcode-select --install
brew安装
brew install rustup-init
rustup-init
# update
brew update
brew upgrade
# 再次执行即可更新现有的rust环境
rustup-init
# 在安装Rust之前,可以使用ustc镜像来提高下载速度:
export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup