0%

MacOS 相关安装及配置

MacOS 相关安装及配置

Homebrew

1
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • 常用命令
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Example usage:
brew search [TEXT|/REGEX/]
brew (info|home|options) [FORMULA...]
brew install FORMULA...
brew update
brew upgrade [FORMULA...]
brew uninstall FORMULA...
brew list [FORMULA...]

Troubleshooting:
brew config
brew doctor
brew install -vd FORMULA

Developers:
brew create [URL [--no-fetch]]
brew edit [FORMULA...]
https://docs.brew.sh/Formula-Cookbook.html

Further help:
man brew
brew help [COMMAND]
brew home
  • 安装位置
1
/usr/local/Cellar/

iTerm2

1
brew cask install iterm2

Oh My Zsh

1
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  • 配置文件
1
~/.zshrc

Git

1
brew install git
  • 常用命令
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]

These are common Git commands used in various situations:

start a working area (see also: git help tutorial)
clone Clone a repository into a new directory
init Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)
add Add file contents to the index
mv Move or rename a file, a directory, or a symlink
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index

examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
grep Print lines matching a pattern
log Show commit logs
show Show various types of objects
status Show the working tree status

grow, mark and tweak your common history
branch List, create, or delete branches
checkout Switch branches or restore working tree files
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
merge Join two or more development histories together
rebase Reapply commits on top of another base tip
tag Create, list, delete or verify a tag object signed with GPG

collaborate (see also: git help workflows)
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.

配置 SSH 方式连接 GitHub

1
2
3
4
5
6
7
8
9
10
11
12
13
//Set a Git username
$ git config --global user.name "VioletQQY"

//Confirm that you have set the Git username correctly:
$ git config --global user.name
> VioletQQY

//Set an email address in Git. You can use your GitHub-provided no-reply email address or any email address.
$ git config --global user.email "forviolet771@gmail.com"

//Confirm that you have set the email address correctly in Git:
$ git config --global user.email
forviolet771@gmail.com
  • 设置一个新的 SSH Key

Paste the text below, substituting in your GitHub email address.

1
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

This creates a new ssh key, using the provided email as a label.

1
Generating public/private rsa key pair.

When you’re prompted to “Enter a file in which to save the key,” press Enter. This accepts the default file location.

1
Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]

At the prompt, type a secure passphrase. For more information, see “Working with SSH key passphrases”.

1
2
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
  • 将 SSH Key 添加到 ssh-agent

Start the ssh-agent in the background.

1
2
eval "$(ssh-agent -s)"
Agent pid 59566

If you’re using macOS Sierra 10.12.2 or later, you will need to modify your ~/.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain.

1
2
3
4
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa

Add your SSH private key to the ssh-agent and store your passphrase in the keychain. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.

1
$ ssh-add -K ~/.ssh/id_rsa
  • 将 SSH Key 添加到 GitHub

拷贝 SSH Key :

1
2
$ pbcopy < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard
  • Git global 配置文件位置
1
vi ~/.gitconfig

Tomcat

  • 使用 Homewbrew 安装 Tomcat
1
brew install tomcat
  • 常用命令
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Using CATALINA_BASE:   /usr/local/Cellar/tomcat/8.5.24/libexec
Using CATALINA_HOME: /usr/local/Cellar/tomcat/8.5.24/libexec
Using CATALINA_TMPDIR: /usr/local/Cellar/tomcat/8.5.24/libexec/temp
Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Using CLASSPATH: /usr/local/Cellar/tomcat/8.5.24/libexec/bin/bootstrap.jar:/usr/local/Cellar/tomcat/8.5.24/libexec/bin/tomcat-juli.jar
Usage: catalina.sh ( commands ... )
commands:
debug Start Catalina in a debugger
debug -security Debug Catalina with a security manager
jpda start Start Catalina under JPDA debugger
run Start Catalina in the current window
run -security Start in the current window with security manager
start Start Catalina in a separate window
start -security Start in a separate window with security manager
stop Stop Catalina, waiting up to 5 seconds for the process to end
stop n Stop Catalina, waiting up to n seconds for the process to end
stop -force Stop Catalina, wait up to 5 seconds and then use kill -KILL if still running
stop n -force Stop Catalina, wait up to n seconds and then use kill -KILL if still running
configtest Run a basic syntax check on server.xml - check exit code for result
version What version of tomcat are you running?
Note: Waiting for the process to end and use of the -force option require that $CATALINA_PID is defined

MySQL

  • 使用 Homebrew 安装 MySQL
1
brew install mysql
  • 常用命令

We’ve installed your MySQL database without a root password. To secure it run:

1
mysql_secure_installation

MySQL is configured to only allow connections from localhost by default.
To connect run:

1
mysql -uroot

To have launchd start mysql now and restart at login:

1
brew services start mysql

Or, if you don’t want/need a background service you can just run:

1
mysql.server start
  • 配置文件
1
/usr/local/etc/my.cnf

Compass

1
2
3
gem update --system
gem install compass
gem install compass-normalize

Mpv

  • 使用 Homebrew 安装 mpv
1
2
brew install mpv --with-bundle  //--with-bundle参数选项将会编译 mpv.app bundle
brew linkapps mpv //将编译出来的mpv.app添加到/Application中,我们会在Launchpad中看到mpv.app
  • 配置文件
1
~/.config/mpv/

mpv.conf 是一些基本的配置,
input.conf 是播放过程中一些操作快捷键的设置,
lua-settings/osc.conf 是播放器控制 UI 自定义设置。

https://github.com/violetqqy/mpv-config