【Terminal】终端美化

MAC终端美化

本文主要介绍oh-my-zsh的安装和使用,因为Mac自带的终端(terminal)不好用,安装了几个所谓的好看的主题依然很难用,故决定使用一个好用且好看的Mac终端,提升生产效率!

iTerms + zsh + oh-my-zsh + brew + wget

iTerms2

是一个终端软件百度搜索下载dmg即可

检查zsh

echo $shell查看默认shell谁否是zsh

如果不是切换为zsh

chsh -s /bin/zsh

检查brew

brew --version

如果未安装:/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)"

               开始执行Brew自动安装程序 
              [cunkai.wang@foxmail.com] 
           ['2021-06-04 20:27:48']['11.2']
        https://zhuanlan.zhihu.com/p/111014448 


请选择一个下载镜像,例如中科大,输入1回车。
源有时候不稳定,如果git克隆报错重新运行脚本选择源。cask非必须,有部分人需要。
1、中科大下载源 2、清华大学下载源 3、北京外国语大学下载源  4、腾讯下载源(不推荐) 5、阿里巴巴下载源(不推荐 缺少cask源)  

请输入序号: 1


  你选择了中国科学技术大学下载源
  
!!!此脚本将要删除之前的brew(包括它下载的软件),请自行备份。
->是否现在开始执行脚本(N/Y) y

--> 脚本开始执行
 Mac os设置开机密码方法:
  (设置开机密码:在左上角苹果图标->系统偏好设置->用户与群组->更改密码)
  (如果提示This incident will be reported. 在用户与群组中查看是否管理员) 
==> 通过命令删除之前的brew、创建一个新的Homebrew文件夹
请输入开机密码,输入过程不显示,输入完后回车
Password:
开始执行
-> 创建文件夹 /usr/local/Homebrew
运行代码 ==> /usr/bin/sudo /bin/mkdir -p /usr/local/Homebrew
此步骤成功
运行代码 ==> /usr/bin/sudo /bin/chmod -R a+rwx /usr/local/Homebrew
运行代码 ==> /usr/bin/sudo /usr/sbin/chown kaituo /usr/local/Homebrew
运行代码 ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Homebrew
git version 2.24.2 (Apple Git-127)

下载速度觉得慢可以ctrl+c或control+c重新运行脚本选择下载源
==> 克隆Homebrew基本文件

未发现Git代理(属于正常状态)
Cloning into '/usr/local/Homebrew'...
remote: Enumerating objects: 192036, done.
remote: Total 192036 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (192036/192036), 49.08 MiB | 13.68 MiB/s, done.
Resolving deltas: 100% (143359/143359), done.
此步骤成功
--创建Brew所需要的目录
运行代码 ==> /usr/bin/sudo /bin/chmod u+rwx /usr/local/bin /usr/local/lib /usr/local/var /usr/local/var/log
运行代码 ==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/bin /usr/local/lib /usr/local/var /usr/local/var/log
运行代码 ==> /usr/bin/sudo /usr/sbin/chown kaituo /usr/local/bin /usr/local/lib /usr/local/var /usr/local/var/log
运行代码 ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/bin /usr/local/lib /usr/local/var /usr/local/var/log
运行代码 ==> /usr/bin/sudo /bin/mkdir -p /usr/local/etc /usr/local/include /usr/local/sbin /usr/local/share /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
运行代码 ==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/etc /usr/local/include /usr/local/sbin /usr/local/share /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
运行代码 ==> /usr/bin/sudo /usr/sbin/chown kaituo /usr/local/etc /usr/local/include /usr/local/sbin /usr/local/share /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
运行代码 ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/etc /usr/local/include /usr/local/sbin /usr/local/share /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
运行代码 ==> /usr/bin/sudo /usr/sbin/chown -R kaituo:admin /usr/local/Homebrew
运行代码 ==> /usr/bin/sudo /bin/mkdir -p /Users/kaituo/Library/Caches/Homebrew
运行代码 ==> /usr/bin/sudo /bin/chmod g+rwx /Users/kaituo/Library/Caches/Homebrew
运行代码 ==> /usr/bin/sudo /usr/sbin/chown -R kaituo /Users/kaituo/Library/Caches/Homebrew
--依赖目录脚本运行完成
==> 创建brew的替身
==> 克隆Homebrew Core
此处如果显示Password表示需要再次输入开机密码,输入完后回车
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Enumerating objects: 969453, done.
remote: Total 969453 (delta 0), reused 0 (delta 0)B | 3.40 MiB/s 
Receiving objects: 100% (969453/969453), 385.21 MiB | 4.55 MiB/s, done.
Resolving deltas: 100% (667157/667157), done.
Updating files: 100% (5942/5942), done.
此步骤成功
==> 克隆Homebrew Cask 图形化软件
  此处如果显示Password表示需要再次输入开机密码,输入完后回车
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask'...
remote: Enumerating objects: 626919, done.
remote: Total 626919 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (626919/626919), 262.26 MiB | 3.64 MiB/s, done.
Resolving deltas: 100% (447707/447707), done.
此步骤成功
==> 克隆Homebrew services 管理服务的启停
  
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 1141, done.
remote: Counting objects: 100% (1141/1141), done.
remote: Compressing objects: 100% (495/495), done.
remote: Total 1141 (delta 484), reused 1141 (delta 484), pack-reused 0
Receiving objects: 100% (1141/1141), 331.50 KiB | 842.00 KiB/s, done.
Resolving deltas: 100% (484/484), done.
此步骤成功
==> 配置国内镜像源HOMEBREW BOTTLE
sed: /Users/kaituo/.zprofile: No such file or directory
环境变量写入->/Users/kaituo/.zprofile
此步骤成功
运行代码 ==> /usr/bin/sudo /bin/chmod -R a+rwx /usr/local/Homebrew
运行代码 ==> /usr/bin/sudo /usr/sbin/chown kaituo /usr/local/Homebrew
运行代码 ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Homebrew

==> 安装完成,brew版本

Homebrew 3.1.9-121-g654c78c-dirty
Homebrew/homebrew-core (git revision a96be80241; last commit 2021-06-04)
Homebrew/homebrew-cask (git revision 1b97d1bc3c; last commit 2021-06-04)
Brew前期配置成功
电脑系统版本:11.2
All user-space services OK, nothing cleaned...

  ==> brew update-reset
  
==> Fetching /usr/local/Homebrew...

==> Resetting /usr/local/Homebrew...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask...

==> Resetting /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...

==> Resetting /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
Updating files: 100% (5684/5684), done.
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services...

==> Resetting /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.


        Brew自动安装程序运行完成
          国内地址已经配置完成

  桌面的Old_Homebrew文件夹,大致看看没有你需要的可以删除。

              初步介绍几个brew命令
本地软件库列表:brew ls
查找软件:brew search google(其中google替换为要查找的关键字)
查看brew版本:brew -v  更新brew版本:brew update
安装cask软件:brew install --cask firefox 把firefox换成你要安装的
        
        欢迎右键点击下方地址-打开URL 来给点个赞
         https://zhuanlan.zhihu.com/p/111014448 

 重启终端 或者 运行 source /Users/DengSchool/.zprofile   否则可能无法使用

安装完毕后可能需要source一下配置源

source /Users/DengSchoo/.zprofile

检查wegt

wget --version

如果未安装则:brew install wget

安装oh-my-zsh

wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh ; sh ./install.sh

高亮即安装成功

安装随机主题

vim ~/.zshrc

修改ZSH_THEME="random"

source ~/.zshrc

posted @ 2021-08-30 21:09  DengSchoo  阅读(277)  评论(0编辑  收藏  举报