Reinstall My Mac - Problems and steps
把光标移动的速度调到最快:
System Preferences => Keyboard => Key Repeat Rate 调到 Fast
System Preferences => Keyboard => Delay Until Repeat 调到 Short
让Touchpad支持三个指头触摸可以Drag窗口:
System Preferences => Accessiblity => Mouse & Touchpad => Touchpad option => Enable Dragging => Three finger drag
设置中英文切换的快捷键:
System Preferences => Keyboard => Shortcut => Input Source => (把两个都check起来,描述自己看)
把希捷的移动硬盘驱动装好(NTFS_for_MAC),不然时光机不能写入备份,
尽管时光机所使用的分区不是NTFS,但是我发现不装这个驱动,仍然不能写入。
最好是先把命令行代理配置好,不然有些东西下不到或者很慢:
命令行:touch ~/.bash_profile
打开新创建的文件,加入以下几行(根据自己的代理端口配置好):
export HTTP_PROXY="http://127.0.0.1:1087"
export HTTPS_PROXY="http://127.0.0.1:1087"
export ALL_PROXY="socks5://127.0.0.1:1086"
命令行: source ~/.bash_profile
如果是zsh的话,就是 source ~/.zshrc
使立即配置生效
不过我装nvm的时候,还是需要把.bash_profile 里面nvm自己写入的那段加载脚本,粘贴到.zshrc里面
nvm默认只会加到.bash_profile里面
让Git走sock5 代理(似乎在命令配置过代理之后,git仍然不能走那个代理,所以单独再给它配置):
git config --global http.proxy ‘socks5://127.0.0.1:1086‘
git config --global https.proxy ‘socks5://127.0.0.1:1086‘
想要取消的话可以:
git config --global --unset http.proxy
git config --global --unset https.proxy
命令行: xcode-select --install
安装完之后 curl 执行出现 fail 443 的问题可以解决, 就可以安装 Homebrew 了( https://brew.sh/ )
命令行: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
——————————————————————————————————————————————————————————
我记录以下Homebrew都在电脑上创建了些什么,以前都没有注意,原来创建了这么多的目录
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following existing directories will be made group writable:
/usr/local/sbin
==> The following existing directories will have their owner set to eda:
/usr/local/sbin
==> The following existing directories will have their group set to admin:
/usr/local/sbin
==> The following new directories will be created:
/usr/local/bin
/usr/local/etc
/usr/local/include
/usr/local/lib
/usr/local/share
/usr/local/var
/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/Homebrew
/usr/local/Frameworks
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod u+rwx /usr/local/sbin
Password:
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/sbin
==> /usr/bin/sudo /usr/sbin/chown eda /usr/local/sbin
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/sbin
==> /usr/bin/sudo /bin/mkdir -p /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/share /usr/local/var /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/Homebrew /usr/local/Frameworks
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/share /usr/local/var /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/Homebrew /usr/local/Frameworks
==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown eda /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/share /usr/local/var /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/Homebrew /usr/local/Frameworks
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/share /usr/local/var /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/Homebrew /usr/local/Frameworks
==> /usr/bin/sudo /bin/mkdir -p /Users/eda/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/eda/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown eda /Users/eda/Library/Caches/Homebrew
==> Downloading and installing Homebrew...
——————————————————————————————————————————————
装完 Homebrew 之后,最好运行以下 brew doctor,看看有提示什么问题
再来装一个 Oh My ZSH( https://ohmyz.sh/ ),让命令行更适合开发者:
装完之后: Please look over the ~/.zshrc file to select plugins, themes, and options.
如果要想在 zsh 和 bash 之间切换,方法如下:
命令行:chsh -s /bin/bash
命令行:chsh -s /bin/zsh
还可以在 System Preferences > Users & Groups 用户名上右键 Advanced options 里面修改
还可以查看以下自己的mac支持哪些shell
命令行:cat /etc/shells
安装pyenv的时候发现它有这些的依赖:
~ brew install pyenv
==> Installing dependencies for pyenv: autoconf, , pkg-config and readline
用 Homebrew 安装的,被放在这个位置 /usr/local/Cellar/pyenv/1.2.16
安装完成之后,有很多陷阱提示,需要根据情况配置:
————————————————————————————————————————————————————————
==> Caveats
==> autoconf
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/autoconf
==>
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc//certs
and run
/usr/local/opt//bin/c_rehash
is keg-only, which means it was not symlinked into /usr/local,
because openssl/libressl is provided by macOS so don‘t link an incompatible version.
If you need to have first in your PATH run:
echo ‘export PATH="/usr/local/opt//bin:$PATH"‘ >> ~/.zshrc
For compilers to find you may need to set:
export LDFLAGS="-L/usr/local/opt//lib"
export CPPFLAGS="-I/usr/local/opt//include"
For pkg-config to find you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt//lib/pkgconfig"
==> readline
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
For compilers to find readline you may need to set:
export LDFLAGS="-L/usr/local/opt/readline/lib"
export CPPFLAGS="-I/usr/local/opt/readline/include"
For pkg-config to find readline you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"
————————————————————————————————————————————————————
按照pyenv 的github说明: https://github.com/pyenv/pyenv#homebrew-on-macos
继续完成配置。
除了前面brew给默认安装的依赖之外,pyenv还有一些依赖:
brew install sqlite3 xz zlib
——————————————————————————————————————————————————————
==> Caveats
==> sqlite
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.
If you need to have sqlite first in your PATH run:
echo ‘export PATH="/usr/local/opt/sqlite/bin:$PATH"‘ >> ~/.zshrc
For compilers to find sqlite you may need to set:
export LDFLAGS="-L/usr/local/opt/sqlite/lib"
export CPPFLAGS="-I/usr/local/opt/sqlite/include"
For pkg-config to find sqlite you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"
==> zlib
zlib is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
For compilers to find zlib you may need to set:
export LDFLAGS="-L/usr/local/opt/zlib/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include"
For pkg-config to find zlib you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/zlib/lib/pkgconfig"
————————————————————————————————————————————————————————