At the time of writing this article, I had only been in touch with the MAC for a short time. After nearly two years of use, I revised this article again.

0 x00 preface

When it comes to macOS, many people like to compete with Windows. In my opinion, although Win is much better than Mac in non-programming ecology and ease of use, professionals are professional because they can choose the right weapons to maximize their effectiveness, right?

What suits you, what allows you to produce or entertain at maximum efficiency, is a better tool.

Advantages of Win are as follows:

  • Excellent compatibility.
  • Coming from a company that loves to do everything, VS.NET is way ahead of the Mac in terms of gameplay, compatibility, performance, and speed for beginners overall.

Disadvantages of Win are as follows:

  • Microsoft is stretched too thin, trying to do everything and monopolize everything. As a result, MS is at the mercy of the companies it serves. This is almost intolerable behavior for large companies. Close to 5% of Silicon Valley companies use Microsoft services (give or take).
  • A poor terminal environment (DOS) and inability to work well with scripts in the * NUx world made the system much less customizable and operable.
  • There are gods like Everything, TotalCMD, and AHK that can do the job. But because of the high learning cost (lol, chaos is one of the learning costs, AHK is really messy, TC is so inhumane).
  • Python’s environment configuration is a pain in the neck

The weakness of Win is why I cut to the Mac.

The advantages of macOS are as follows:

  • The Mac is great because of the combination of terminals and beautiful graphics. Suitable for non-Microsoft tech stack and heavy Office users.
  • * NuX applications are convenient and very easy to combine with script files to create powerful combination skills.
  • On the other hand, this combination of skills is much worse in environment configuration and operation fluency.

The disadvantages of macOS are as follows:

  • There is a dearth of entertainment. Metal is not that far from DirectX.
  • Software and some less than a little.

This article introduces macOS from the following perspectives

How to Gracefully Use macOS 0x00 Preface 0x01 Built-in System 1.1 System Settings 1.2 Built-in Software 1.3 Shortcut Keys and Touch Pad 0x02 Required Software 2.1 Daily Required Software 2.2 Required Software Development 2.2.1 GUI Application 2.2.2 CMD Command ▼ 2.3 Programming Language of Required Software 2.3.1 Shell 2.3.2 Python ▼ 0x03 Pit History 3.1 Daily Classes 01. Time machine unable to complete backup 02. Download site software package display corrupted ▼ 3.2 Programming classes 01. Homebrew's problems with Python 0xEE Reference linkCopy the code

0x01 Built-in system

1.1 System Settings

General

  • Default browser: Google Chrome

Decktop & Screen Saver

  • Desktop/screensaver

Language & Region

  • language
  • Regional Settings

Security & Privacy

  • A firewall

Sharing

  • Remote Control – SSH

Trackpad

  • Set the gestures
  • Scrool Direction: Natural

1.2 Built-in Software

  • iTunes
  • iPhoto
  • iMessage
  • SpotLight -> Alfred 3

1.3 Shortcut keys and Touch pad

  • CMD is the command key and is generally used as a universal shortcut for all desktop programs.
  • CTRL, in general, reinforces the functionality of the program, and this functionality tends to be non-CMD (window operations, select, copy and paste, etc.).
  • The Shift key is usually used to reinforce the action. Generally, it takes the operation further or the other way around.

  • CMD + TAB =~ Alt + TAB to switch between programs

  • CMD + ‘In-app window toggle

  • CMD + h window to hide

  • CMD + m minimize window
  • CMD +n Create a window
  • Open the CMD + o
  • CMD + s to save
  • CMD + shift + s save as
  • CMD + p to print print
  • CMD + w to close
  • cmd+q quit

  • cmd+a select all

  • cmd+i show info
  • cmd+n create a new folder
  • cmd+f search
  • cmd+c copy
  • cmd+v paste
  • CMD +delete Deletes the selected file
  • CMD + Shift +delete Clear the recycle bin

  • CMD + = amplification

  • CMD + – narrow
  • CMD +t Creates a new TAB
  • CMD + r refresh

  • CMD + Shift +3 captures the entire screen

  • CMD + Shift +4 intercepts the selection area
  • CMD + Shift +4+SPACE intercepts the selection window
  • CMD + mouse click -> select discontinuous files
  • Control + mouse click -> is equivalent to right click in Win

  • fn+left home

  • fn+right end
  • fn+up pageup
  • fn+down pagedown

Touchpad gesture:

  • Click on the

    • One-finger click – Click
    • One-finger slide – Slide the mouse cursor
    • Two-finger click – the equivalent of the Right mouse button on Windows
    • Three-finger click-dash search
  • Sliding and scaling

    • Double finger slide up and down – scroll
    • Double finger zoom – same as image zoom on Android
    • Double – finger double – zoom only
    • Double finger rotation. – Rotation
    • Swipe left and right to switch between in-app pages
    • Fingers from right to left
    • Swiping around three fingers – Full screen App switch
    • Thumb and eat in nameless zoom – Launchpad

0x02 Required Software

2.1 Daily necessities of essential software

  • starter

    • Alfred 3
    • SpotLight
  • Web tools

    • Chrome
  • Social communication

    • QQ
    • WeXin
  • Graphic images

    • Adobe PhotoShop CC
    • Adobe PhotoShop LightRoom
    • Sketch
    • Annotate
    • Camtasia 2
    • Snagit
    • ScreenFlow
    • Final Cut Pro
    • MPlayerX
    • QuickTime
    • iQiyi
    • NeteaseMusic
    • IINA
  • Office software

    • European dictionary
    • Calibre
    • Wiznote
    • PDF Reader
    • iBook
    • Microsoft Office
    • Work suite: includes Pages, Numbers, Keynote
    • XMind
    • Airmail
    • TeamViewer
    • OmniFocus
    • OmniGraffle
    • OmniOutline
    • OmniPlan
  • The system software

    • Sogou input method
    • AppCleaner
    • CleanMyMac
    • VMWare
    • BetterZip
    • Caffeine / Amphetamine
    • PopClip
    • HandShaker
    • AirDroid

2.2 Necessary software development requirements

2.2.1 GUI application

  • The end user

    • iTerm2
  • IDE

    • PyCharm
    • IntellijIDEA
    • WebStorm
  • The editor

    • MacVim cooperate C – VIM
    • Sublime Text 3
  • The background components

    • MySQL
    • PostgreSQL
    • Redis
    • MongoDB
  • Database management software

    • Navicat
    • Datagrip
    • RoboMongo
    • RDM
    • Dash
  • Web tools

    • SS QT
    • Charles, Wireshark
  • Chrome

    • My friend: Baidu Cloud, which requires offline installation
    • AdBlock: AD blocking
    • AutoPatchWork: Link to next page
    • Axure RP Extension : Axure
    • CSSViewer
    • Dream Afar New Tab
    • JSON Editor
    • JSON View
    • Octotree
    • One-Click Extensions Manager
    • Proxy SwitchyOmega
    • React Developer Tools
    • Redux DevTools
    • Vue.js devtools
    • Vimium
  • Code warehouse

    • Github Desktop
    • SourceTree
  • GIS related

    • ArcGIS
    • QGIS
    • PostgreSQL + PostGIS

2.2.2 CMD command

if test ! $(which brew); then
    echo "Installing homebrew..."
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi

# Make sure we’re using the latest Homebrew.
brew update

# Upgrade any already-installed formulae.
brew upgrade --all

# Install GNU core utilities (those that come with OS X are outdated).
# Don’t forget to add `$(brew --prefix coreutils)/libexec/gnubin` to `$PATH`.
brew install coreutils
sudo ln -s /usr/local/bin/gsha256sum /usr/local/bin/sha256sum

# Install some other useful utilities like `sponge`.
brew install moreutils
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, `g`-prefixed.
brew install findutils
# Install GNU `sed`, overwriting the built-in `sed`.
brew install gnu-sed --with-default-names
# Install Bash 4.
brew install bash
brew tap homebrew/versions
brew install bash-completion2
# We installed the new shell, now we have to activate it
echo "Adding the newly installed shell to the list of allowed shells"
# Prompts for password
sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells'
# Change to the new shell, prompts for password
chsh -s /usr/local/bin/bash

# Install `wget` with IRI support.
brew install wget --with-iri

# Install RingoJS and Narwhal.
# Note that the order in which these are installed is important;
# see http://git.io/brew-narwhal-ringo.
brew install ringojs
brew install narwhal

# Install Python
brew install python
brew install python3

# Install ruby-build and rbenv
brew install ruby-build
brew install rbenv
LINE='eval "$(rbenv init -)"'
grep -q "$LINE" ~/.extra || echo "$LINE" >> ~/.extra

# Install more recent versions of some OS X tools.
brew install vim --override-system-vi
brew install homebrew/dupes/grep
brew install homebrew/dupes/openssh
brew install homebrew/dupes/screen
brew install homebrew/php/php55 --with-gmp

# Install font tools.
brew tap bramstein/webfonttools
brew install sfnt2woff
brew install sfnt2woff-zopfli
brew install woff2

# Install some CTF tools; see https://github.com/ctfs/write-ups.
brew install aircrack-ng
brew install bfg
brew install binutils
brew install binwalk
brew install cifer
brew install dex2jar
brew install dns2tcp
brew install fcrackzip
brew install foremost
brew install hashpump
brew install hydra
brew install john
brew install knock
brew install netpbm
brew install nmap
brew install pngcheck
brew install socat
brew install sqlmap
brew install tcpflow
brew install tcpreplay
brew install tcptrace
brew install ucspi-tcp # `tcpserver` etc.
brew install homebrew/x11/xpdf
brew install xz

# Install other useful binaries.
brew install ack
brew install dark-mode
#brew install exiv2
brew install git
brew install git-lfs
brew install git-flow
brew install git-extras
brew install hub
brew install imagemagick --with-webp
brew install lua
brew install lynx
brew install p7zip
brew install pigz
brew install pv
brew install rename
brew install rhino
brew install speedtest_cli
brew install ssh-copy-id
brew install tree
brew install webkit2png
brew install zopfli
brew install pkg-config libffi
brew install pandoc

# Lxml and Libxslt
brew install libxml2
brew install libxslt
brew link libxml2 --force
brew link libxslt --force

# gitbook autocover
brew install pkg-config cairo pango libpng jpeg giflib

# Install Cask
brew install caskroom/cask/brew-cask
brew tap caskroom/versions

# aerial screen saver
# https://github.com/JohnCoates/Aerial
brew cask install aerial
# https://github.com/sindresorhus/quick-look-plugins
brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql qlimagesize webpquicklook suspicious-package quicklookase qlvideo

brew update && brew upgrade --all && brew cleanup && brew pruneCopy the code

2.3 Programming language of required software

2.3.1 Shell

Most of the command-line tools used by the MAC come from FreeBSD, not GNU, so many of the commands will be similar to regular Linux commands.

I like GNU software.

Refer to my notes for Shell scripts. Section 9 How to use Shell_ elegantly

Speaking of shells, in addition to using bash’s shell, ZSH’s shell is also worth a try. (fish shell is kennethreitz’s favorite, though)

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"Copy the code

2.3.1.1 Oh My Zsh

2.3.2 Python

Although I have dabbled in many languages, I am not proficient in any of them. The only language I can talk about is Python.

Of course, once installed, you can refer to my Pythonista toolset in section 3

Domestic and foreign network environment is not unobstructed, installation and configuration environment this small matter has become a big thing.

I have three stages for installing Python versions and managing Python dependencies:

  • Entry level
  • novice
  • A master class

2.3.2.1 entry-level

Originally at the entry level, I configured the environment like most Pythonista, first version:

  • For Python version management, or no management at all, BREW installs a Python2 for Python2 code development and brew installs a Python3 code development.
  • For Python dependency management, simply venv an environment directly using virualenv or its wrapper, then active, and PIP install -r req.txt

2.3.2.2 novice

  • For Python version management, use Pyenv
  • For Python dependency management, use PyEnv VirtualEnv to export multiple environments and then switch environments.

brew install pipenv
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.zshrc

# Open another terminal
# Don't like to write compatible code, all code tends to be 3.5+V = 3.5.2 | wget HTTP: / / http://mirrors.sohu.com/python/$v/Python-$v.tar.xz -P ~/.pyenv/cache/; pyenv install$vV = 3.6.0 | wget HTTP: / / http://mirrors.sohu.com/python/$v/Python-$v.tar.xz -P ~/.pyenv/cache/; pyenv install$vV = 2.7.11 | wget HTTP: / / http://mirrors.sohu.com/python/$v/Python-$v.tar.xz -P ~/.pyenv/cache/; pyenv install$v
Download anaconda3-4.4.0-macosx-x86_64. sh from anaconda3-4.4.0-macosx-x86_64. sh from anaconda3-4.4.0-macosx-x86_64Mv anaconda3-4.4.0-macosx-x86_64. sh ~/. Pyenv /cache/ && pyenv install anaconda3-4.4.0# Set Global Python to 2.7.11, note: Try not to set Py3 to Global, otherwise Homebrew has some dependencies that depend on Py2, which can cause some strange problems.Pyenv global 2.7.11 PIP install -i https://pypi.doubanio.com/simple requestsThe following one is used to install basic code completion
pip install -i https://pypi.doubanio.com/simple --upgrade "Jedi > = 0.9.0" "Json xml-rpc > =, version 1.8.1" "Service_factory > = 0.1.5" flake8 pytest autoflake hy

Create the most commonly used Py3 virtual environmentPyenv virtualenv 3.5.2 py3 - daily pyenv activate py3 - daily PIP install -i https://pypi.doubanio.com/simple requests PIP install -i https://pypi.doubanio.com/simple beatutifulsoup4 pip install -i https://pypi.doubanio.com/simple ipython[notebook] pip install -i https://pypi.doubanio.com/simple jupyterThe following one is used to install basic code completion
pip install -i https://pypi.doubanio.com/simple --upgrade "Jedi > = 0.9.0" "Json xml-rpc > =, version 1.8.1" "Service_factory > = 0.1.5" flake8 pytest autoflake hy

# Build Anaconda's data science AI environmentPyenv VirtualEnv Anaconda3-4.4.0 Py3 -ai Pyenv Activate Anaconda3-4.4.0 /envs/ Py3 -ai Pyenv deactivate# After entering a project
pyenv activate py3-proj
pip install -r requirements/local.txt
pip install -r requirements/prod.txt
# requirements/local. TXT and requirements/prod. TXT depend on requirements/base.txtCopy the code

2.3.2.3 master level

In fact, the problem with the first entry-level management approach is that the Python version is so crude that python3.4 solved a previous python3.3 problem. To avoid the potential risk of such bizarre version differences, Python versions are often locked in development and deployment.

Even if the rough version management problems of the entry level management approach are solved, dependencies are also locked. PIP does have the ability to use freeze output for TXT for purposes of locking. But personally, I don’t think that’s enough, at least you need to know about dependency trees and things like that, right? Also know what can be updated?

And, like the Package. json in the Node project, you should put all the dependencies into it.

  • For Python version and dependency package management, use Pen V

That means you only need one.

2.3.3 JavaScript and Node Environment

nvm && npm && yarn

NVM main user management node version, Linux/MAC only,windower best download node version install, remember to configure environment variables.

NPM is the main user management package. Chinese people prefer to use CNPM. However, THE CNPM package management is poor

npm install cnpm
cnpm install yarn -g
# Check the download source
# yarn config get registry
yarn config set registry https://registry.npm.taobao.orgCopy the code

Yarn analyzes dependencies when using package management, which is great for buggy Node_module.

2.3.4 Java

Java environment installation is a bit of a pain in the ass. Especially multi-version management.

TODO: Add JAVA environment installation laterCopy the code

2.4 DotFiles for mandatory Configuration

See YadotFiles for more details

  • According to my personal habit, on the basis of OhMyZsh, I added the configuration of environment variables and some functions.

For example, if I type todos in the directory where I’m writing this article, I can see how many todos I dug while writing this article that haven’t been filled in yet. The following

3e383c54 (Micheal Gardner 2017-11-18 12:40:38 +0800 422) ## 0xEE TODO TO LIST
ae86b7cb (Micheal Gardner 2017-11-19 21:39:49 +0800 245) ### 5. TODOc0d51990 (Micheal Gardner 2017-11-22 16:42:08 +0800 552) TODO: Micheal Gardner 2017-11-22 16:42:08 +0800 561 When I type todos in the directory where I'm writing this article, I can see how many todos I dug while writing this article that haven't been filled in yet.Copy the code

Please refer to YadotFiles for details

0 x03 on history of pit

3.1 the daily class

01. Time machine cannot complete backup

I have a habit of backing up regularly. During one backup, I found that the backup could not be completed. After several tests:

  1. My first guess was that the hard disk was faulty. I changed a hard disk and the problem remained the same.
  2. Copying a few large files doesn’t feel like a problem with poor interface contact.
  3. I think the problem may be caused by the excessive number of files. Delete node_module and back up again. Of course, there is a chance that this is a mistake. After all, probabilistically speaking, a broken clock can be right twice a day.

When connecting external hard disks, turn off the network.

02. The software package display on the download site is corrupted

Sometimes it’s not the software that’s corrupted, but the macOS security configuration that turns off an unidentified App

Enable this option in terminal and click Anywhere on the Security and privacy area.

sudo spctl --master-disableCopy the code

3.2 programming class

01. Homebrew and Python issues

An error always occurs when executing the following code in Python:

ip = socket.gethostbyname(socket.gethostname())
# socket.gaierror: [Errno 8] nodename nor servname provided, or not known

The host name was not set properly
sudo scutil --set ComputerName "newname"
sudo scutil --set LocalHostName "newname"
sudo scutil --set HostName "newname"
dscacheutil -flushcache
Then restart the computerCopy the code

If you have Homebrew installed, if you use PyEnv or Anaconda and set the current environment to Python3 by default (not recommended), but if you want to change the default Python version to Python3, Some pythonPath problems pop up. Execute the following command to temporarily mask the problem, but it is not clear if there are any hidden problems.

mv /usr/local/ lib/python2.7 / site - packages/sitecustomize. Py/usr /local/ lib/python2.7 / site - packages/sitecustomize. Py. BackCopy the code

02. Homebrew installs past files

0xEE Reference link

  • Part of this article’s command-line installation borrows from dev-setup

ChangeLog:

  • 2016-02 Determine the general content
  • 2017-06-28 Rework text, adjust article structure, Python environment and Homebrew installation environment
  • 2017-10-05 Revised text again, update irregularly