Skip to content

Instantly share code, notes, and snippets.

@visioncan
Last active December 29, 2021 01:56
Show Gist options
  • Save visioncan/7a1762196f80298fc377 to your computer and use it in GitHub Desktop.
Save visioncan/7a1762196f80298fc377 to your computer and use it in GitHub Desktop.
CasksInstall
#!/bin/bash
# xcode command tool
xcode-select --install
# check
xcode-select -p
# homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# check brew
brew doctor
brew update
# QuickLook
# https://github.com/sindresorhus/quick-look-plugins
# https://github.com/samuelmeuli/glance
brew install --cask glance webpquicklook suspicious-package qlvideo apparency
brew install
[email protected] \
mitmproxy \
imagemagick \
graphicsmagick \
youtube-dl \
lame \
ffmpeg \
[email protected]
# dnsmasq \ # 改由 valet 安裝及設定
brew install --cask alfred
brew alfred link
brew install --cask google-chrome
brew install --cask microsoft-edge
brew install --cask firefox
brew install --cask 1password
brew install --cask textmate
brew install --cask skype
# brew install --cask nally
brew install --cask iterm2
brew install --cask dropbox
brew install --cask imageoptim
# brew install --cask vox
brew install --cask sourcetree
brew install --cask evernote
brew install --cask subler #字幕合成
brew install --cask synergy
brew install --cask spotify
# brew install --cask x-mirage
brew install --cask cloudapp
# brew install --cask colorpicker # 沒了
# brew install --cask colorpicker-hex # 沒了
# brew install --cask colorpicker-developer # M1 不能用
# brew install --cask colorpicker-skalacolor # M1 不能用
# brew install --cask colorpicker-materialdesign # M1 不能用
brew install --cask r-name
brew install --cask appcleaner
brew install --cask audacity
brew install --cask istat-menus
brew install --cask macdown
brew install --cask sublime-text
brew install --cask docker
# brew install --cask debookee # 網路觀查
brew install --cask iina # 影片播放
brew install --cask paw
brew install --cask slack
brew install --cask visual-studio-code
brew install --cask sequel-ace # mysql DB clinet
# brew install --cask icons8 # icon 收集
brew install --cask simplenote
# brew install --cask droplr
brew install --cask agenda
brew install --cask cheatsheet #顯示快速鍵
brew install --cask redis-app # redis 軟體
# brew install --cask pgadmin4 # postgros sql 資料庫工具
#brew install --cask sqlitebrowser # 沒了
# brew install --cask xee
#brew install --cask toggldesktop # 桌面計時軟體
#brew install --cask wwdc
# brew install --cask ksdiff # Kaleidoscope 的命令工具
#brew install --cask monolingual #移除語系工具
# brew install --cask sketch
# need password
brew install --cask microsoft-teams
brew install --cask splashtop-personal
brew install --cask homebrew/cask-drivers/synology-drive
# brew install --cask splashtop-streamer
# brew install --cask teamviewer
# brew install --cask recordit
brew install --cask robo3t # monogo DB clinet
brew install --cask adobe-air # 良 app
# font
brew tap homebrew/cask-fonts
brew install svn # 部份 font 要先裝 svn
brew install --cask font-fontawesome
brew install --cask font-aileron
brew install --cask font-source-sans-pro
brew install --cask font-hack
brew install --cask font-fira-mono-for-powerline
brew install --cask font-fira-sans
brew install --cask font-fira-code
brew install --cask font-open-sans
brew install --cask font-mplus
brew install --cask font-exo-2
brew install --cask font-noto-sans-cjk-tc #思源黑
brew install --cask font-noto-serif-cjk-tc
# brew install --cask font-source-han-sans #思源黑
# brew install --cask font-source-han-serif #思源宋
brew install --cask font-jf-open-huninn # jf open 粉圓
brew install --cask font-fira-code-nerd-font # iterm 用
# 其他中文字
https://gist.github.com/visioncan/6a5453f77649add27aa4155cc8015070
# 下載 Macdown theme:
cd ~/Library/Application Support/MacDown/Themes
curl -O https://raw.githubusercontent.com/jasonm23/markdown-css-themes/gh-pages/avenir-white.css
# install for zsh theme font
# https://github.com/powerline/fonts.git
# 再去 iterm2 改字體 Profile -> Text -> Non-ASCII Font 改為 Ubuntu Mono Derivative Powerline Font
# 思源黑體
# brew install --cask https://gist.githubusercontent.com/visioncan/20cf9a4b9304196e35d2/raw/0affe47ac38749a0b4e895c9b60e6b7df4d313fc/font-source-han-sans-TC.rb
#####
# zsh
#####
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 手動裝 zsh autosuggestion plugin
git clone git://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
# VIM
sh <(curl -L https://github.com/kaochenlong/eddie-vim2/raw/master/utils/install_zhtw.sh)
cd ~/.vim/colors && curl -O https://raw.githubusercontent.com/tomasr/molokai/master/colors/molokai.vim
# 修改color
# vim ~/.vim/plugin/settings/settings.vim
# colorscheme 改為 rails_envy 或 molokai
# https://github.com/tomasr/molokai
# 編輯時讓可以滑鼠滾動
# set mouse=a
# nvm
# https://github.com/creationix/nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
nvm install 15
nvm alias default 15
#nvm install stable
# f2e tool
npm install -g \
yarn \
gulp \
diff-so-fancy \
http-server
# pnpm \
# babel-eslint \
# eslint \
# standard \
# uglify-js \
# vsce \
# gitbook-cli \
# hexo-cli \
#####
# composer
#####
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
# 放到全域裡
sudo mv composer.phar /usr/local/bin/composer
#rvm
\curl -sSL https://get.rvm.io | bash -s stable
rvm requirements
rvm list known
rvm install 2.1.1
rvm use 2.1.1
gem install cocoapods
gem install scss-lint
# https://gist.github.com/saetia/1623487
# Avoid creating .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
#Disable disk image verification
defaults write com.apple.frameworks.diskimages skip-verify -bool true
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
#Enable Safari’s debug menu
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
# Enable the Develop menu and the Web Inspector in Safari
defaults write com.apple.Safari IncludeDevelopMenu -bool true
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
# 顯示完成 URL
defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true
# 改變螢幕截取的副檔名
defaults write com.apple.screencapture name "shot"
# 睡眠後需要密碼
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
# 關閉 safari 偏好設定不要 Spotlight 建議
defaults write com.apple.Safari UniversalSearchEnabled -bool false
# 系統偏好設定 > Spotlight > 關閉 Spotlight 建議與 bing 搜尋網頁
# 開啟 alfred2 使用 dropbox 的 Apps 資料夾
defaults write com.runningwithcrayons.Alfred-Preferences-3 dropbox.allowappsfolder -bool TRUE
# 使用純文字為 TextEdit 預設格式
defaults write com.apple.TextEdit RichText -int 0
##### Finder
# Finder 預設開啟為家目錄
defaults write com.apple.finder NewWindowTarget -string "PfHm"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}"
# Finder 改搜尋範圍為目前資料夾
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# Finder 顯示路徑列
defaults write com.apple.finder ShowPathbar -bool true
# 關閉改變副檔名警告
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# 允許在 QuickLook 裡選取文字
defaults write com.apple.finder QLEnableTextSelection -bool YES
# 預設使用列表顯示
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# 顯示隱藏檔
defaults write com.apple.finder AppleShowAllFiles -bool true
# 在桌面顯示 外接、掛載硬碟
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
# 顯示副檔名
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# 預設儲存視窗為展開模式
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
killall Finder
#增加 Dock 的空格
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}' && killall Dock
# MplayerX
defaults write org.niltsh.MPlayerX SeekStepTimeR -float 5
defaults write org.niltsh.MPlayerX SeekStepTimeL -float -10
# 改中文化資料夾
sudo cp /System/Library/CoreServices/SystemFolderLocalizations/zh_TW.lproj/SystemFolderLocalizations.strings /System/Library/CoreServices/SystemFolderLocalizations/zh_TW.lproj/SystemFolderLocalizations.strings.backup
sudo cp /System/Library/CoreServices/SystemFolderLocalizations/en.lproj/SystemFolderLocalizations.strings /System/Library/CoreServices/SystemFolderLocalizations/zh_TW.lproj/SystemFolderLocalizations.strings
# 還要去資料夾移除 .localized
cd ~
rm */.localized
cd /
sudo rm */.localized
cd /System/
sudo rm */.localized
# SIP (System Integrity Protection)
# 開機按著 Command + R 直接進入
# 關閉 SIP
csrutil disable
# 開啟 SIP
csrutil enable
#重開機後 /Volums/Macintosh HD/System/Library/....
#Setup Github
ssh-keygen -t rsa -C "[email protected]"
#copy ssh key to clipboard for adding to github.com
pbcopy < ~/.ssh/id_rsa.pub
#test connection
ssh -T [email protected]
# dnsmasq
mkdir -pv $(brew --prefix)/etc/ && \
echo 'address=/test/127.0.0.1' > $(brew --prefix)/etc/dnsmasq.conf && \
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons && \
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist && \
sudo mkdir -v /etc/resolver && \
sudo zsh -c 'echo "nameserver 127.0.0.1" > /etc/resolver/test'
#flush cache
# sudo discoveryutil mdnsflushcache && scutil --dns
sudo killall -HUP mDNSResponder
brew services restart dnsmasq # 重啟
#To configure dnsmasq, copy the example configuration to /usr/local/etc/dnsmasq.conf and edit to taste.
# cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
# 編輯 dnsmasq.conf 67行
#server=8.8.8.8
#server=195.68.1.1
# 83行
#address=/.iyp.tw/172.16.16.32 # ex:把 iyp.tw 子網域的轉到 172.16.16.32
#address=/dev/127.0.0.1 # ex:把 .dev 子網域的轉到 127.0.0.1
# 建資料夾
#sudo mkdir -p /etc/resolve
# 寫入檔案 /etc/resolver/dev
# sudo tee /etc/resolver/dev >/dev/null <<EOF
# nameserver 127.0.0.1
# EOF
# To have launchd start dnsmasq at startup:
#sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons
# Then to load dnsmasq now:
#sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
# 重啟
#sudo launchctl stop homebrew.mxcl.dnsmasq
# 就好,會自動啟用
# `sudo launchctl stop homebrew.mxcl.dnsmasq && sudo launchctl start homebrew.mxcl.dnsmasq`
# 關閉憑證
https://github.com/sammcj/delete-unknown-root-ca
# 按cmd+shift+q 登出
# Airmail 設定
# https://cl.ly/123J0s3E1j3L
# https://cl.ly/3m0z3R3a1C3u
# sublime text Packages install
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/
rm -r User
ln -s ~/Dropbox/Apps/Sublime/User
# sublime text change icons
# sudo curl -L -o /Applications/Apps/Sublime\ Text.app/Contents/Resources/Sublime\ Text.icns https://www.dropbox.com/s/3v9s3ho1jivyfe8/Sublime%20Text.icns?dl=0
# 將目錄下 node_modules 在 timemachine 裡排除
find `pwd` -type d -maxdepth 3 -name 'node_modules' | xargs -n 1 tmutil addexclusion
# App 路徑:
Agenda:
~/Library/Group Containers/WRBK2Z2EG7.group.com.momenta.agenda.macos/Release/Application/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment