Mac

来自bbxwiki
跳转至: 导航搜索

开启三指拖动

系统偏好设置----辅助功能----鼠标与触控板----启用拖移

First Do

  • deps
# homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# 国内源
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
brew update
  • main
# brew 1st
# sudo 调整brew目录权限
# sudo chown $(whoami) -Rv /usr/local
brew install wget xz coreutils gnu-sed
# brew dev
brew install ctags pkg-config maven gdb unrar
brew install autojump
# img convert
brew install imagemagick
# web-net
brew install nginx telnet
# brew fun
brew install sl cowsay fortune cmatrix figlet toilet
 
# mac-cli
sh -c "$(curl -fsSL https://raw.githubusercontent.com/guarinogabriel/mac-cli/master/mac-cli/tools/install)"
 
# oh-my-zsh
wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh


Download

# spec version
wget https://npm.taobao.org/mirrors/node/v8.9.4/node-v8.9.4-darwin-x64.tar.gz -P ~/stub
wget https://download.jetbrains.8686c.com/idea/ideaIU-2017.3.6.dmg -P ~/stub
wget https://download.filezilla-project.org/client/FileZilla_3.39.0_macosx-x86_setup_bundled.dmg -P ~/stub
# stable
wget https://vscode.cdn.azure.cn/stable/bc24f98b5f70467bc689abf41cc5550ca637088e/VSCode-darwin-stable.zip -P ~/stub
wget https://atom-installer.github.com/v1.33.0/atom-mac.zip?s=1543426441&ext=.zip -P ~/stub
wget https://desktop.githubusercontent.com/releases/1.5.0-2f0c701f/GitHubDesktop.zip -P ~/stub
wget https://dldir1.qq.com/WechatWebDev/1.0.0/bb9c1558bb234f98b0a5558bcb629fa8/wechat_devtools_1.02.1811290.dmg -P ~/stub

$HOME/.bash_profile 样例

# gnu coreutils
[ ! -f "$HOME/.dir_colors" ] && gdircolors --print-database > $HOME/.dir_colors
if brew list | grep coreutils > /dev/null ; then
    PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"
    alias ls='ls -F --show-control-chars --color=auto'
    eval `gdircolors -b $HOME/.dir_colors`
fi
 
# alias
alias grep='grep --color'
alias egrep='egrep --color'
alias fgrep='fgrep --color'
alias k="clear; pwd"
alias h="clear; history; pwd"
alias gs="git status"
alias ga="git add"
alias md2pdf-pf="pandoc -N -s --toc --pdf-engine=xelatex -V CJKmainfont='PingFang SC' -V geometry:margin=1in"
alias md2pdf-yh="pandoc -N -s --toc --pdf-engine=xelatex -V CJKmainfont='Microsoft YaHei' -V geometry:margin=1in"
alias WGET='wget --no-check-certificate'
 
# PATH
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$HOME/bin:$HOME/bin/adm:$PATH
export LD_LIBRARY_PATH=.:~/lib:$LD_LIBRARY_PATH
export DEV_HOME=$HOME/devhome
export XAMPP_HOME=/Applications/XAMPP
export GITHUB_HOME=$DEV_HOME/www.github.com
export NODEJS_HOME=$(ls -d $HOME/opt/nodejs/node-v8.*-darwin-x64)
export PATH=$NODEJS_HOME/bin:$XAMPP_HOME/bin:$PATH
export PATH=/usr/local/opt/gnu-sed/libexec/gnubin:$PATH
export MANPATH=/usr/local/opt/gnu-sed/libexec/gnuman:$MANPATH
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
 
# SDK PATH
 
# locale
export LC_ALL=zh_CN.UTF-8
export LC_CTYPE=zh_CN.UTF-8

目录结构

UNAME=$(whoami)
XHOME=/Users/$UNAME/xhome
VHOME=/var/home/$UNAME
sudo mkdir -p ${VHOME} 2>/dev/null
sudo chown -Rv $UNAME ${VHOME}
mkdir -p ${XHOME}/{bin,etc,lib,stub,data,opt,devhome} 2>/dev/null
mkdir -p ${VHOME}/{log,run,tmp,z-export,z-research} 2>/dev/null

工具官网

brew类似apt-get

  • 用法
brew install wget
brew uninstall wget
brew search /apache*/ 
  • ref
https://github.com/Homebrew/homebrew
http://snowolf.iteye.com/blog/774312


小贴士

修改截图保存目录(缺省桌面)
defaults write com.apple.screencapture location ~/Pictures/screenshots; 
killall SystemUIServer

快捷键

Finder中显示/关闭隐藏文件 shift + command + .


查看已安装字体

fc-list
fc-list :lang=zh-cn


参见