安装 HomeBrew
直接用官方命令很容易就 443,原因你懂的^^
使用国内这位大佬的脚本 https://gitee.com/cunkai/HomebrewCN.git, 在 gitee 上面大家可以顺便 star 一下,支持一下大佬。
安装命令:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
emmm… 安装的时候可能需要重复输入密码上百次估计有,是正常的。。。
脚本执行过程中可能需要安装 Command Line Tools, 如果安装失败请自行百度安装,实在不会可以联系我。。。(无偿的,认真脸)
结束之后可以用
brew -v
验证一下
安装 google-chrome(谷歌浏览器)
前面已经安装过 HomeBrew 了, google-chrome 就可以直接用命令安装了
brew cask install google-chrome
安装配置 oh-my-zsh
安装更新 zsh
brew install zsh
切换 bash 为 zsh
chsh -s /bin/zsh
安装 oh-my-zsh
git clone https://gitee.com/mirrors/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
vim ~/.zshrc
设置自己喜欢的主题, 修改 ~/.zshrc 中的 ZSH_THEME
ZSH_THEME="xiong-chiamiov"
主题效果如下:
问题解决
在第一行加上 参考
ZSH_DISABLE_COMPFIX=true
目的是为了解决如下这种问题
[oh-my-zsh] For safety, we will not load completions from these directories until
[oh-my-zsh] you fix their permissions and ownership and restart zsh.
[oh-my-zsh] See the above list for directories with group or other writability.
[oh-my-zsh] To fix your permissions you can do so by disabling
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
[oh-my-zsh] owner of these directories is either root or your current user.
[oh-my-zsh] The following command may help:
[oh-my-zsh] compaudit | xargs chmod g-w,o-w
[oh-my-zsh] If the above didn't help or you want to skip the verification of
[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.
另外,在 ~/.zshrc 的最后一行加上
source ~/.bash_profile
可以避免 Mac 系统改为 zsh 之后,环境变量失效的问题。
解决休眠唤醒后,没有声音的问题
在终端执行下面这两句操作
sudo kextunload /System/Library/Extensions/AppleHDA.kext
sudo kextload /System/Library/Extensions/AppleHDA.kext
脚本内容
on run {input, parameters}
do shell script "" with administrator privileges
set the rootPwd to text returned of (display dialog "Enter your root passwd:" default answer "" with hidden answer)
try
do shell script "echo " & rootPwd & "|sudo -S killall coreaudiod"
do shell script "echo " & rootPwd & "|sudo -S kextunload /System/Library/Extensions/AppleHDA.kext"
do shell script "echo " & rootPwd & "|sudo -S kextload /System/Library/Extensions/AppleHDA.kext"
do shell script "sudo -k" --logout root
display dialog "The operation has been completed. If no problem is fixed,
please restart the system." buttons {"OK"} with icon 1 with title "Success"
on error
display dialog "Password error, please rerun." buttons {"OK"} with icon caution with title "Error"
end try
return input
end run
终端使用 FTP
brew install lftp
用法
lftp ftp://用户名:密码@地址
登录之后
set ftp:charset gbk
set file:charset utf8
参考:https://www.jianshu.com/p/78e3651e64ae