markdown macos-info.md

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown macos-info.md相关的知识,希望对你有一定的参考价值。

# Helpful Information for MacOS
The below information is current as of 2019-02-01 and applies to MacOS 10.14.x (Mojave).  

This document is meant to serve as an aid and reference in preparing a MacOS system, the process and .dotfiles are completed manually. Note that the default Terminal is replaced with iTerm2 and Bash v5.  

For additional information or help please feel free to ping via https://www.coreygo.com.

#### System information commands
- `uptime` displays current system uptime
- `system_profiler SPHardwareDataType` displays hardware overview
- `system_profiler -listDataTypes` lists available system_profiler options
- `system_profiler -detailLevel basic > ~/system_profile.txt` outputs to text document for sharing

# Security
Review the [macOS Security and Privacy Guide](https://github.com/drduh/macOS-Security-and-Privacy-Guide).

#### Set root password
- `sudo passwd -u root`
* For Development
- `sudo spctl --master-disable`

# Software updates
- `softwareupdate -l`
- `sudo softwareupdate -iaR --verbose`

# System
* Hide Desktop
  - `defaults write com.apple.finder CreateDesktop false && killall Finder`
* Show All Files
  - `defaults write com.apple.finder AppleShowAllFiles YES`
  - CMD+SHIFT+.

# Networking
#### Set computer name (System Preferences → Sharing)
```
sudo scutil --set ComputerName "entropy"
sudo scutil --set HostName "entropy"
sudo scutil --set LocalHostName "entropy"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName $(scutil --get LocalHostName)
```

#### Set login screen message
`sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "coreygo.com"`

#### Disable .DS_Store on network shares
`defaults write com.apple.desktopservices DSDontWriteNetworkStores true`

#### Disable screenshot drop shadow
`defaults write com.apple.screencapture disable-shadow -bool true && killall SystemUIServer`

#### Speed up SMB client to Synology NAS by disabling packet signing
https://support.apple.com/en-us/HT205926
```
sudo -s
echo "[default]" >> /etc/nsmb.conf
echo "signing_required=no" >> /etc/nsmb.conf
exit
```

# Software

### Homebrew
* Xcode Command Line Tools
  - `xcode-select --install`
* [Homebrew](https://brew.sh/)
  - `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
* [Homebrew Cask](https://caskroom.github.io/)
  - `brew tap caskroom/cask`
  - `brew tap caskroom/versions`
  - `brew tap caskroom/drivers`
  - `brew tap caskroom/fonts`
  - `brew tap homebrew/services`
  - `brew tap buo/cask-upgrade` ([brew cu](https://github.com/buo/homebrew-cask-upgrade))
  - `brew install vitorgalvao/tiny-scripts/cask-repair` ([cask-repair](https://github.com/Homebrew/homebrew-cask/blob/master/CONTRIBUTING.md))
* [Homebrew FAQ](https://docs.brew.sh/FAQ.html)
  - `brew update-reset && brew update && brew upgrade && brew cleanup -s && brew cu`
  - `brew cleanup -s`
  - `rm -rf $(brew --cache)`
  - `brew missing` and `brew doctor` and `brew config`
  - `brew uninstall {{package name}}` to uninstall a Homebrew package
  - `brew cask zap {{cask name}}` to uninstall a Homebrew cask package
  - `brew untap {{cask name}}` to untap a Homebrew cask
  > Additional Post Install
  ```
  cat << 'EOF' >> ~/.bash_profile
  # Set alias bup to update Homebrew
  alias bup="brew update-reset && brew update && brew upgrade && brew cu && brew cleanup -s && rm -rf $(brew --cache) && brew missing && brew doctor"
  EOF
  ```
* [Search for Formulae](http://formulae.brew.sh/) `brew search google` (includes formulae and casks)
* [Search for Casks](https://caskroom.github.io/search)

### Fonts
Sources: [Fira Code](https://github.com/tonsky/FiraCode), [Hack](https://sourcefoundry.org/hack/), [Nerd Fonts](https://nerdfonts.com/), [Source Code Pro](https://github.com/adobe-fonts/source-code-pro), [Roboto](https://fonts.google.com/specimen/Roboto)

Search: `brew search /roboto/`
  - `brew cask install font-roboto`
  - `brew cask install font-firacode-nerd-font`
  - `brew cask install font-fira-code`
  - `brew cask install font-meslo-nerd-font`
  - `brew cask install font-sourcecodepro-nerd-font`
  - `brew cask install font-source-code-pro`

Search for installed fonts: `system_profiler SPFontsDataType | grep Fura`
  
### Terminal
* Create empty ~/.bash_profile if needed (shouldn't be if steps above were used)
  - `if [ ! -f ~/.bash_profile ]; then touch ~/.bash_profile; fi;`
* Create ~/.bashrc if needed and source ~/.bash_profile
  - `if [ ! -f ~/.bashrc ]; then echo '[ -n "$PS1" ] && source ~/.bash_profile;' >> ~/.bashrc; fi;`
* [iTerm](https://www.iterm2.com)
  - `brew cask install iterm2-beta` or `brew cask install iterm2`
  > Post Install
  - Run iTerm then make it the default Terminal.
  - Install Shell Integration and Utilities (checks for and updates ~/.bash_profile)
  - `curl -L https://iterm2.com/shell_integration/install_shell_integration_and_utilities.sh | bash`
  - Change default profile: 160x48, Solarized Dark, FuraCode Nerd Font 14pt Regular (use ligatures, anti-aliased), Terminal.app compatibility — additional Key Mappings changes may be required for natural editing (like keyboard shortcuts for cursor movement in Terminal and vim)
  
### Bash and Command Line Binaries
* [Bash v5.*](https://www.gnu.org/software/bash/)
  - `brew install bash`
  > Post Install
  ```
  # Switch to using brew-installed bash as default shell
  if ! fgrep -q '/usr/local/bin/bash' /etc/shells; then
    echo '/usr/local/bin/bash' | sudo tee -a /etc/shells;
    chsh -s /usr/local/bin/bash;
  fi;
  ```
  - `echo $BASH_VERSION`
* Set default language and source imports
  ```
  cat << 'EOF' >> ~/.bash_profile
  # Set Language
  export LANG="en_US.UTF-8"
  export LC_ALL="$LANG"

  # Imports
  test -e "${HOME}/.secrets" && source "${HOME}/.secrets"
  EOF
  ```
  
* Set default editors
  ```
  cat << 'EOF' >> ~/.bash_profile
  # Set default editors
  export EDITOR="$(which vim)"
  export VISUAL="$EDITOR"
  export HOMEBREW_EDITOR="$EDITOR"
  export GIT_EDITOR="$EDITOR"
  EOF
  ```
* [Bash Completion](https://formulae.brew.sh/formula/bash-completion@2)
  - `brew install bash-completion@2`
  > Post Install
  ```
  cat << 'EOF' >> ~/.bash_profile
  # Enable bash tab completion
  export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d"
  [[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
  EOF
  ```

## Command Line Binaries
### Replace and augment MacOS default binaries
- `brew install vim --with-override-system-vi --with-python3`
- `brew install coreutils`
> Post Install coreutils (optional, will cause warning from `brew doctor`)
```
All commands have been installed with the prefix 'g'.

If you really need to use these commands with their normal names:

cat << 'EOF' >> ~/.bash_profile
# Set local opt coreutils bin $PATH
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
EOF
```
- `brew install curl`
> Post Install curl
```
cat << 'EOF' >> ~/.bash_profile
# Set local opt curl bin $PATH
export PATH="/usr/local/opt/curl/bin:$PATH"
EOF
```
- `brew install diffutils`
- `brew install findutils`  
or `brew install findutils --with-default-names` (optional, will cause warning from `brew doctor`)
- `brew install gawk`
- `brew install gnu-sed --with-default-names`
- `brew install gnu-tar --with-default-names`
- `brew install gnu-which --with-default-names`
- `brew install gnutls`
- `brew install grep --with-default-names`
- `brew install gzip`
- `brew install htop`
- `brew install openssh --with-ldns`
- `brew install rsync`
- `brew install screen`
- `brew install tmux`
- `brew install tree`
- `brew install watch`
- `brew install wdiff`
- `brew install wget`

> Post Install command line binaries
```
cat << 'EOF' >> ~/.bash_profile
# Set local system bin $PATH
export PATH="$PATH:/usr/local/sbin"
EOF
```

### Additional command line binaries
- `brew install emacs` [emacs](https://www.gnu.org/software/emacs/)
- `brew install nmap` [nmap — network mapper](https://nmap.org/)
- `brew install youtube-dl` [youtube-dl](https://github.com/rg3/youtube-dl/blob/master/README.md)

## Git
- `brew install git`
```
git config --global user.name "Corey Gouker"
git config --global user.email corey@coreygo.com
git config --global user.signingkey F8189720240A11D1
git config --global github.user coreygo
git config --global core.editor vim
git config --global color.ui auto
git config --global commit.gpgsign true
git config --global credential.helper osxkeychain
```
- `brew install git-lfs` && `git lfs install`

## Applications

### Google
* [Google Chrome](https://www.google.com/chrome/)
  - `brew cask install google-chrome-beta`
  - or/and for side by side installation… `brew cask install google-chrome`
* [Google Drive File Stream](https://support.google.com/a/answer/7491144) 
  - `brew cask install google-drive-file-stream`
* [Google Android File Transfer](https://www.android.com/filetransfer/)
  - `brew cask install android-file-transfer`

### Web, Security, Communications
* [Firefox Developer Edition](https://www.mozilla.org/en-US/firefox/developer/)
  - `brew cask install firefox-developer-edition`
  - or/and for side by side installation… `brew cask install firefox`
* [Tor Browser](https://www.torproject.org)
  - `brew cask install tor-browser`
* [Bitwarden](https://bitwarden.com/)
  - `brew cask install bitwarden`
* [1Password](https://1password.com)
  - `brew cask install 1password-beta`
  - or for non-beta version `brew cask install 1password`
* [GPG Suite](https://gpgtools.org)
  - `brew cask install gpg-suite`
* [Irssi](https://irssi.org/documentation/)
  - `brew install irssi`
* [Tunnelblick](https://tunnelblick.net/)
  - `brew cask install tunnelblick`
* [Slack](https://slack.com/downloads/)
  - `brew cask install slack`
* [Discord](https://discordapp.com/download)
  - `brew cask install discord`
* [Signal](https://signal.org/)
  - `brew cask install signal`
* [Keybase](https://keybase.io/) (requires KEXT - System Preferences → Security & Privacy → General)
  - `brew cask install keybase`

### Development
* [Visual Studio Code](https://code.visualstudio.com)
  - `brew cask install visual-studio-code-insiders`
  - or for non-Insiders build… `brew cask install visual-studio-code`
  > Post Install Visual Studio Code — Insiders ([extensions list](https://gist.github.com/coreygo/9f096d741fdac117dd1429cbcdb034fe) and [settings information](https://gist.github.com/coreygo/85030b1cf61b47752c6a884e98165732))
  - to reinstall all extensions from a terminal  
  `curl -fsSL https://git.io/fh6Lz | bash`
* [JetBrains Toolbox](https://www.jetbrains.com/toolbox/)
  - `brew cask install jetbrains-toolbox`
* [Eclipse IDE](https://www.eclipse.org)
  - `brew cask install eclipse-installer`
* [Postman](https://www.getpostman.com/)
  - `brew cask install postman`
* [VirtualBox](https://www.virtualbox.org) (requires KEXT - System Preferences → Security & Privacy → General)
  - `brew cask install virtualbox`
  - `brew cask install virtualbox-extension-pack`
* [Docker](https://www.docker.com)
  - `brew cask install docker`  
  https://download.docker.com/mac/stable/Docker.dmg
  - or for edge… `brew cask install docker-edge`  
  https://download.docker.com/mac/edge/Docker.dmg
  > Post Install (using stable or edge Docker Desktop for Mac)
  ```
  etc=/Applications/Docker.app/Contents/Resources/etc
  ln -s $etc/docker.bash-completion $(brew --prefix)/etc/bash_completion.d/docker
  ln -s $etc/docker-machine.bash-completion $(brew --prefix)/etc/bash_completion.d/docker-machine
  ln -s $etc/docker-compose.bash-completion $(brew --prefix)/etc/bash_completion.d/docker-compose
  ```  
  - or if not using the "Docker Desktop for Mac" app (VirtualBox based install, not using the HyperKit hypervisor) consider installation using the non-cask formulae, details for this option have not been provided or tested
* [Vagrant](https://www.vagrantup.com)
  - `brew cask install vagrant`
* [Packer](https://packer.io/)
  - `brew install packer`
* [Terraform](https://www.terraform.io/)
  - `brew install terraform`

### System and Utilities
* [Transmission Remote GUI](https://github.com/transmission-remote-gui/transgui)
  - `brew cask install transmission-remote-gui`
* [Keka](http://www.kekaosx.com/en/)
  - `brew cask install keka`
* [CyberDuck](https://cyberduck.io/)
  - `brew cask install cyberduck`
* [Radio Silence](https://radiosilenceapp.com)
  - `brew cask install radio-silence`
* [OverSight](https://objective-see.com/products/oversight.html) (requires KEXT - System Preferences → Security & Privacy → General)
  - `brew cask install oversight`
  > Workaround for [installer hang](https://github.com/caskroom/homebrew-cask/issues/32364#issuecomment-309447358)
  - Open GUI and activate run in 'headless' mode.
* [ClamAV](https://www.clamav.net/documents/installing-clamav#osx)
  - `brew install clamav`
  > Review the (somewhat accurate) [MacOS installation guide](https://www.clamav.net/documents/installation-on-macos-mac-os-x) and [FAQ for additional details](https://github.com/Cisco-Talos/clamav-faq) before starting the process
  - `freshclam -v` for latest definitions 
  - `clamscan -r -i --bell ~/` for an on-demand directory/file scan
  - `clamscan -r -i --bell --cross-fs=no --detect-pua=yes /` for an on-demand "complete" scan

### Media Streaming and Production
* [Open Broadcaster Software](https://obsproject.com/)
  - `brew cask install obs`
  - Install [OBS-NDI plugin](https://obsproject.com/forum/resources/obs-ndi-newtek-ndi™-integration-into-obs-studio.528/) for streaming from networked systems
* [Avidemux](http://avidemux.sourceforge.net/download.html)
  - `brew cask install avidemux`
* [Kap](https://getkap.co/)
  - `brew cask install kap`

### Audio/Video Playback and Management
* [VLC](https://www.videolan.org)
  - `brew cask install vlc`
* [Plexamp](https://www.plex.tv/plex-labs/#modal-plexamp-downloads)
  - `brew cask install plexamp`
* [MusicBrainz Picard](https://picard.musicbrainz.org/)
  - `brew cask install musicbrainz-picard`
  > Post Install
  - `brew install flac mp3gain`
  - MusicBrainz Picard Preferences → Plugins → Install ReplayGain → Enable → Make It So
  - Path to metaflac `/usr/local/bin/metaflac`
  - Path to mp3gain `/usr/local/bin/mp3gain`

### eBook Management
* [Calibre](https://calibre-ebook.com/download)
  - `brew cask install calibre`
  > Post Install
  - [DeDRM Tools](https://github.com/apprenticeharper/DeDRM_tools/releases)
* [Amazon Kindle](https://www.amazon.com/kindle-dbs/fd/kcp)
  - `brew cask install kindle`
  > Post Install
  - `chmod -x /Applications/Kindle.app/Contents/MacOS/renderer-test`
* [Adobe Digital Editions](https://www.adobe.com/products/digital-editions.html)
  - `brew cask install adobe-digital-editions`

### Adobe
* [Adobe Creative Cloud](https://creative.adobe.com/products/download/creative-cloud)
  - `brew cask install adobe-creative-cloud`
  > Post Install
  - `open '/usr/local/Caskroom/adobe-creative-cloud/latest/Creative Cloud Installer.app'`

### Gaming
* [Steam](https://steamcommunity.com/)
  - `brew cask install steam`
* [OpenEMU](https://openemu.org/)
  - `brew cask install openemu`

### Evernote
* [Evernote](https://evernote.com/)
  - `brew cask install evernote`
* [Skitch](https://evernote.com/products/skitch)
  - `brew cask install skitch`

### Conferencing and Remote Computing
* [RealVNC Viewer](https://www.realvnc.com/en/connect/download/viewer/macos/)
  - `brew cask install vnc-viewer`
* [Microsoft Remote Desktop](https://aka.ms/rdmac)
  - `brew cask install microsoft-remote-desktop-beta`
* [TeamViewer](https://www.teamviewer.us/downloads/)
  - `brew cask install teamviewer`
* [ZoomUS](https://zoom.us/join)
  - `brew cask install zoomus`

# Programming Environments

* [Node Version Manager](https://github.com/creationix/nvm)
  - `curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash`
  > Post Install
  - Update ~/.bash_profile (also undo any changes to .bashrc)
  ```
  cat << 'EOF' >> ~/.bash_profile
  # Enable Node Version Manager
  export NVM_DIR="$HOME/.nvm"
  [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
  [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
  EOF
  ```
  - `source ~/.bash_profile` or restart terminal session
  > NVM Manual Upgrade
  ```
  (
    cd "$NVM_DIR"
    git fetch --tags origin
    git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
  ) && \. "$NVM_DIR/nvm.sh"
  ```
* [Node](https://nodejs.org/en/) — via NVM
  - `nvm install --lts` and/or `nvm install v10.15.1`
  - `nvm install node --reinstall-packages-from=node`
  - `nvm install-latest-npm`
  - `npm i -g npm npm-check npm-check-updates eslint standard typescript tslint prettier create-react-app gatsby-cli`
  - `npm ls-remote --lts`
  - `npm ls -g --depth=0`
  > [Yarn Package Manager](https://yarnpkg.com/en/)
  - `brew install yarn --without-node`

* [Python](https://www.python.org/) — review additional details prior to [installing Python via Homebrew](https://docs.brew.sh/Homebrew-and-Python) to avoid potential issues.
  - `brew install python`
  > Post Install
  - Update ~/.bash_profile
  ```
  cat << 'EOF' >> ~/.bash_profile
  # Set Python 3 $PATH
  export PATH="/usr/local/opt/python@3/libexec/bin:$PATH"
  EOF
  ```
  - `pip3 install --upgrade pip setuptools wheel virtualenv pipenv`
  > Post Install for [pipenv](https://pipenv.readthedocs.io/en/latest/)
  ```
  cat << 'EOF' >> ~/.bash_profile
  # Set Python 3 pipenv to create .venv in project path  
  export PIPENV_VENV_IN_PROJECT=true
  EOF
  ```
  - `mkdir -p {{project name}} && cd "$_"` to create a new Python project directory and `pipenv install` to create a new pipfile and virtualenv then `pipenv shell` to activate the virtualenv, you are now ready to `pip3 install {{package name}}` (use pip3 to avoid issues), and remember to deactivate the shell with `exit` 
  - See `pipenv --help` or go [here for advanced usage details](https://pipenv.readthedocs.io/en/latest/advanced/)
  - If Python 2 is required for pipenv and virtualenv usage `brew install python@2` for a Python 2 project `pipenv install --two`, remember to review the Python via Homebrew link above before installing Python 2

* [Ruby](https://www.ruby-lang.org/en/) — via [rbenv](https://github.com/rbenv/rbenv#homebrew-on-macos), also [review here for Rails and additional information](https://gorails.com/setup/osx/)
  - `brew install rbenv`
  > Post Install
  - `rbenv init`  
  - Update ~/.bash_profile
  ```
  cat << 'EOF' >> ~/.bash_profile
  # Enable rbenv Ruby environment manager
  if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi # This loads rbenv
  EOF
  ```
  - `source ~/.bash_profile` or restart terminal session
  - `rbenv --version`
  - `curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash`
  - `rbenv install 2.5.3` or to list available versions `rbenv install -l`
  - `rbenv global 2.5.3` or to get current active version `rbenv global`
  - `ruby -v`
  - `gem env` for RubyGems environment details
  - `gem env home` check the location where gems are being installed
  - `gem outdated` and `gem update --force`
  - `gem install bundler`

* [Go](https://golang.org/)
  - `brew install go`
  > Post Install
  ```
  cat << 'EOF' >> ~/.bash_profile
  # Go Language
  export PATH="$PATH:/usr/local/opt/go/libexec/bin"
  EOF
  ```
  - `source ~/.bash_profile` or restart terminal session
  - `brew install dep`
  - `brew install gox`

* [Oracle Java](https://jdk.java.net/)
  - `brew cask install java`

* [Java via AdoptOpenJDK](https://adoptopenjdk.net/)
  - `brew cask install adoptopenjdk`

* [Processing](https://processing.org/)
  - `brew cask install processing`

## SDKs
* [Google Cloud SDK](https://cloud.google.com/sdk/docs/quickstart-mac-os-x)
  - `brew cask install google-cloud-sdk`
* [AWS CLI & Python SDK](https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-virtualenv.html) — first follow steps above to install Python 3 including pipenv via Homebrew
  - `cd ~ && mkdir -p .aws && cd "$_" && pipenv install awscli boto3 && pipenv run aws --version`
  - `cd ~/.aws && pipenv run aws --version` to confirm the AWS CLI version, for help see `pipenv run aws help`
  - or run a command like `aws configure` after activating the shell `cd ~/.aws && pipenv shell` remember to `exit`

## Wacom Intuos Tablet
  - `brew cask install wacom-tablet`

## OpenBCI
* [ftdi-vcp-driver](http://www.ftdichip.com/Drivers/VCP.htm)
  - `brew cask install ftdi-vcp-driver`
* [OpenBCI GUI](https://github.com/OpenBCI/OpenBCI_GUI/releases)
  - `brew cask install openbci-gui`

以上是关于markdown macos-info.md的主要内容,如果未能解决你的问题,请参考以下文章

markdown转换为图片

转换rst到markdown总结

markdown [Markdown HowTo]作为Markdown语法的秘籍

python markdown干啥用的

markdown前端渲染

如何用markdown生成目录