Appearance
item2
Iterm2 是苹果系统增加的命令行工具,定制化很强使用方便,并且外观也好看。
安装
直接从官网下载安装即可:https://iterm2colorschemes.com/
风格设定
我们可以定制非常漂亮的 iterm 风格,下面是斑马兽在使用的风格
安装风格
首先从https://iterm2colorschemes.com/ 网站提供了丰富的风格包以供下载。
解包后在 iterm 软件包中导入风格包
dracula
draculatheme 提供了对多种软件风格设置,也包括item2
的风格。
常用命令
brew 使用命令行进行软件与服务的管理,所以掌握常用命令是有必要的。
基本命令
下面掌握基本的 brew 命令
命令 | 说明 |
---|---|
brew search 关键词 | 查找包含关键词的软件 |
brew install 软件名 | 安装软件 |
brew list | 查看所有已经安装的软件 |
brew info 软件名 | 查看安装软件的详细信息 |
brew outdated | 查看可更新的软件 |
brew upgrade 软件名 | 更新指定软件 |
brew upgrade | 更新所有软件 |
brew uninstall 软件名 | 卸载软件 |
brew update | 更新 brew |
brew cleanup | 清除本地缓存 |
cast
brew cast 用于安装有图形 GUI 界面的软件如 sourcetree、OBS 等。下面来掌握相关命令。
命令 | 说明 |
---|---|
brew cask install 软件名 | 安装软件 |
brew cask list | 查看已安装软件列表 |
brew cask info 软件名 | 查看软件信息 |
服务管理
brew services 用于管理使用 brew 安装的服务,如 Mysql、Nginx、Redis 等
命令 | 说明 |
---|---|
brew services list | 查看服务与运行状态 |
brew services start mysql | 开启 mysql 服务 |
brew services start --all | 开启所有服务 |
brew services restart mysql | 重起 mysql 服务 |
brew services restart --all | 重起所有服务 |
brew services stop mysql | 停止 mysql 服务 |
brew services stop --all | 停止所有服务 |
PHP
有时系统中需要安装多个版本的 PHP,下面来学习安装和使用。
安装 PHP
搜索 PHP 软件
$ brew search php
==> Formulae
brew-php-switcher php-code-sniffer php@7.3 phpmd phpunit
denji/nginx/php-session-nginx-module php-cs-fixer ✔ php@7.4 ✔ phpmyadmin
php ✔ php@7.2 phplint phpstan
根据搜索结果安装最新版本 PHP 与 php 7.4
brew install php php@7.4
查看当前使用的 PHP 版本
$ php -v
PHP 8.0.0 (cli) (built: Nov 30 2020 13:51:52) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
版本切换
将 php 版本切换为 7.4,首先移除 php8 版本
$ brew unlink php
Unlinking /usr/local/Cellar/php/8.0.0_1... 24 symlinks removed
然后设置为 PHP7 版本
$ brew link php@7.4
Linking /usr/local/Cellar/php@7.4/7.4.13_1... 25 symlinks created
If you need to have this software first in your PATH instead consider running:
echo 'export PATH="/usr/local/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc