[toc]
官网地址:https://brew.sh/
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
一键安装:
安装指令:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
卸载指令(如果需要):
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"
升级版本
brew update
查看版本
brew -v
国内安装地址:
/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"
或者
/bin/bash -c "$(curl -fsSL https://gitee.com/wejectchan/brew/raw/master/install.sh)"
安装慢可以设置镜像源 (中科大):
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
brew update
环境变量配置:这里使用的 python 为 Xcode 自带的
export PATH=/Users/apple/Library/Python/3.8/bin:$PATH
如果需要python2的话
export PATH=/Users/apple/Library/Python/2.7.18/bin:$PATH
下载 Python2.7.18
brew install pyenv
pyenv install 2.7.18
open ~/.pyenv/version
知道 2.7.18 版本放到 /Users/apple/Library/Python/
这里去
编辑 pip2
vim pip2
- 安装命令
brew install python3
- 导出环境变量
export PATH="$(brew --prefix python@3.11)/libexec/bin:$PATH"
官网地址:https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py
用哪个版本的 Python 运行安装脚本,pip 就被关联到哪个版本,如果是 Python3 则执行以下命令
sudo python2 get-pip.py
或
sudo python3 get-pip.py
官网地址:http://nodejs.cn/download/
配置环境变量:
PATH=$PATH:/usr/local/bin/
brew install nodejs
brew install npm
npm -v
node -v
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install [name]
GitHub:https://github.com/warpdotdev/Warp
官网地址:http://iterm2.com/downloads.html
博客:https://zhuanlan.zhihu.com/p/550022490
oh-my-zsh 的官网地址:https://ohmyz.sh/
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
1、把 oh-my-zsh 项目 Clone 下来
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
2、复制 .zshrc
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
3、更改你的默认 Shell
chsh -s /bin/zsh
安装完成之后,在 /bin
目录下会多出一个 zsh
的文件。
你可以通过以下命令来查看:
cat /etc/shells
注意,cat
后面是有个空格的。
其次,macOS 在 Catalina 版本之前都是使用 dash
作为终端,
如果你想修改为 zsh
,可以使用以下命令:
chsh -s /bin/zsh
当然,你后悔了,想改回原来的 dash
,同样使用上面的 chsh
命令就可以。
chsh -s /bin/bash
主题目录:~/.oh-my-zsh/themes
Github 地址:https://github.com/ohmyzsh/ohmyzsh/wiki/themes
vim ~/.zshrc
ZSH_THEME="spaceship"
powerlevel9k主题安装
- 用 powerlevel9k 为例,通过
git clone
下载到 oh-my-zsh 放置第三方主题的目录中 -
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
- 修改
ZSH_THEME="spaceship"
为ZSH_THEME="powerlevel9k"
-
source ~/.zshrc
安装 powerline 和 PowerFonts
官网地址:https://powerline.readthedocs.io/en/latest/installation.html
pip install powerline-status
当然安装之前要确保你已经安装了 python 环境和 pip , python 环境一般 Mac 系统都会自带的,所以如果你在安装过程中遇到:
zsh: command not found: pip
你也可以通过命令来安装
sudo easy_install pip
PowerFonts 是一个字体库,要安装字体库需要先把 git clone
到本地,然后执行源码中的 install.sh
具体的流程如下:
# git clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts
powerlevel10k主题安装
- 安装
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
- 编辑 .zshrc 文件, 文件路径 ~/.zshrc
open ~/.zshrc
ZSH_THEME="powerlevel10k/powerlevel10k"
.zshrc设置
- 下载 Dream_01.zshrc 或 Dream_02.zshrc
- 找到 .zshrc 文件将 Dream_01.zshrc 或 Dream_02.zshrc 中代码复制到 zshrc 最下面
- 文件目录 :
open ~/.zshrc
- 安装 Hack Nerd 字体库
- iTerm -> Preferences -> Profiles -> Text -> font -> 修改成 Hack Nerd Font
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
history
z
)
zsh-syntax-highlighting 安装
-
cd ~/.oh-my-zsh/custom/plugins/ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
- 然后在文件末尾添加:
-
source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # 如果使用命令 brew 安装,则是添加这条命令语句
-
source ~/.zshrc
zsh-autosuggestions 安装
-
cd ~/.oh-my-zsh/custom/plugins/ git clone https://github.com/zsh-users/zsh-autosuggestions
brew install cocoapods
brew install ruby@3.0
echo 'export PATH="/opt/homebrew/opt/ruby@3.0/bin:$PATH"' >> ~/.zshrc
export LDFLAGS="-L/opt/homebrew/opt/ruby@3.0/lib"
export CPPFLAGS="-I/opt/homebrew/opt/ruby@3.0/include"
source ~/.zshrc
-
安装
sudo gem install -n /usr/local/bin cocoapods
-
安装
sudo gem install -n /usr/local/bin cocoapods
-
安装本地库
// 国外地址,如果你能科学上网的话,可以使用这个方法 git clone https://github.com/CocoaPods/Specs.git ~/.cocoapods/repos/trunk // 清华大学镜像,速度杠杠的,推荐使用 git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git ~/.cocoapods/repos/trunk
sudo gem update --system
///这一步建议是先执行后续用到了再添加
///例如,你使用Fastlane进行自动化部署这个是需要的
gem sources --remove https://rubygems.org/
gem sources --add https://gems.ruby-china.com/
gem sources -l
*** CURRENT SOURCES ***
https://gems.ruby-china.com/
sudo gem install -n /usr/local/bin cocoapods
如果安装了多个 Xcode 使用下面的命令选择(一般需要选择最近的 Xcode 版本)
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
方式一(官方镜像)
git clone https://github.com/CocoaPods/Specs.git ~/.cocoapods/repos/trunk
方式二(清华镜像)
git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git ~/.cocoapods/repos/trunk
pod search AFNetworking
下载安装包https://flutter.cn/docs/get-started/install/macos
# Path to flutter
export PATH="$PATH:/opt/flutter/bin"
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
官网地址:https://www.oracle.com/java/technologies/downloads
选择相应的安装包一路点击下一步就可以
➜ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
或者
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home
PATH=$JAVA_HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export JAVA_HOME
export PATH
export CLASSPATH
java -version
-
下载
sudo git clone --recursive https://github.com/theos/theos.git /opt/theos
-
配置环境变量
export THEOS=/opt/theos export PATH=$PATH:$THEOS/bin
brew install ldid
- 安装
cd /opt
git clone https://github.com/AloneMonkey/MonkeyDev
cd /opt/MonkeyDev/bin
./md-install 进行安装
- 编译报错
file not found: /usr/lib/libstdc++.dylib
https://github.com/devdawei/libstdc-
cd /opt
git clone https://github.com/4ch12dy/xia0LLDB
git clone https://github.com/DerekSelander/LLDB
vi ~/.lldbinit
command script import /opt/homebrew/Cellar/chisel/2.0.1/libexec/fbchisellldb.py
command script import /opt/LLDB/lldb_commands/dslldb.py
command script import /opt/xia0LLDB/src/xlldb.py
command alias freshxlldb command script import /opt/xia0LLDB/src/xlldb.py
https://xcdownloader.com/ https://github.com/RobotsAndPencils/XcodesApp/
CodeSnippet
~/Library/Developer/Xcode/UserData/CodeSnippet
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime
可以把写好的 shell 脚本在终端任何地方都可以执行
# 赋予执行权限
chmod +x ~/scripts/my_script.sh
# 创建软链接
ln -s ~/scripts/my_script.sh /usr/local/bin/my_script
- Alfred
- Android Studio
- App Cleaner & Uninstaller
- Beyond Compare
- GitHub Desktop
- Hopper Disassembler
- LocalizationEditor(https://github.com/igorkulman/iOSLocalizationEditor)
- LX Music(https://github.com/lyswhut/lx-music-desktop)
- MachOView(https://github.com/fangshufeng/MachOView)
- Microsoft Edge
- OneDrive
- Pasta
- Snipaste
- Sublime Text
- SwitchHosts!
- Typora(主题:https://github.com/liangjingkanji/DrakeTyporaTheme)
- Visual Studio Code
- ZY Player(https://github.com/Hunlongyu/ZY-Player)
- XMind
- OpenInTerminal(https://github.com/Ji4n1ng/OpenInTerminal)