HomeBrew
- macOS(或 Linux)缺失的软件包的管理器
- Homebrew 会将软件包安装到独立目录,并将其文件软链接至
/usr/local
。 - Homebrew 不会将文件安装到它本身目录之外,所以您可将 Homebrew 安装到任意位置。
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" #安装
- 基本命令
brew search qq
brew install node
brew install qq
brew install qq --cask
brew info gradle
# 1.下载rb仓库
git clone https://github.com/Homebrew/homebrew-core.git
# 2.项目目录下查看`./Formula/gradle.rb`此文件的目录 修改一下 用Sourcetree打开
brew install ~/locapath/gradle.rb #替换url.sha256安装指定版本
# 或者 git homebrew-core. 搜索 gradle.rb. History查看历史版本,找到Viewfile 点 raw 。得到路径
···
brew install
https://raw.githubusercontent.com/Homebrew/homebrew-core/cfb4bf89c574b9eb123c19fc1a1506daeacca107/Formula/gradle.rb
```sh
# 上述命令执行会失败。把gradle.rb下载下来本地执行即可.
[homebrew-core protobuf示例](https://github.com/Homebrew/homebrew-core/blob/master/Formula/protobuf.rb)
brew unlink
通过 Homebrew 安装后bin,安装后实际的文件都存放在了/usr/local/Cellar
目录中。只是在/usr/local/
中创建了符号链接,使用 unlink,只会删除符号链接,但并不会删除程序本身,/usr/local/Cellar
目录中的程序文件还依然存在。后面可以再运行 link 命令,就可以把相应的程序包恢复回来- 软件版本切换
brew switch gradle 5.4.1
brew switch gradle 5.6.2
sshpass安装和使用
brew search sshpass
=> We won't add sshpass because it makes it too easy for novice SSH users to
ruin SSH's security.
=> 我们不会添加sshpass,因为它使新手SSH用户太容易了破坏了SSH的安全性。homebrew认为这个不好 哈哈 所以用以下方法安装
brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb
oh-my-zsh使用
- 先选zsh
- 其它插件比如
cheatsheet
brew install zsh zsh-completions
chsh -s /bin/zsh #将zsh设置为默认shell
cat /etc/shells => 查看shells
echo $SHELL => /bin/zsh (查看默认sh)
- 安装完成后在~/ 目录下会有一个 /oh-my-zsh文件 ls可以看到
CODE_OF_CONDUCT.md cache oh-my-zsh.sh tools
CONTRIBUTING.md custom plugins
LICENSE.txt lib templates
README.md log themes
plugins 就是自带的插件的位置 themes就是主题的位置
2. cd到custom ls可以看到
xample.zsh plugins themes
自定义的插件放在 plugins下
3. 安装自动补全插件
echo $ZSH_CUSTOM = /Users/liangze/.oh-my-zsh/custom
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-completions $ZSH_CUSTOM/plugins/zsh-completions
git clone https://github.com/valentinocossar/vscode.git $ZSH_CUSTOM/plugins/vscode
然后 VSCode ~/.zshrc 在plugins=(git) 加上 zsh-autosuggestions zsh-syntax-highlighting zsh-completions插件
4. 安装自定义主题
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
然后在 ~/.zshrc 里写上
ZSH_THEME="powerlevel9k/powerlevel9k"
POWERLEVEL9K_MODE="nerdfont-complete"
POWERLEVEL9K_PROMPT_ON_NEWLINE=false
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(virtualenv os_icon user dir_writable dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status)
POWERLEVEL9K_USER_ICON="\uF415" #
POWERLEVEL9K_ROOT_ICON="\uF09C"
#POWERLEVEL9K_SUDO_ICON=$'\uF09C' #
POWERLEVEL9K_TIME_FORMAT="%D{%H:%M}"
iTerm2安装
brew search iTerm
brew install iterm2
- 设置默认
iTerm2->Make iTerm2 Default
- 设置头像
Profiles->General->Icon
- 设置命令结束后不关闭
Profiels->Session->after a session ends