前端mac裝機清單

一、XCode,Xcode command lines tools

$ xcode-select --install

按照指引安裝即可

如果你不做 Obj-C 開發(fā),可以跳過 XCode 的安裝,直接去下載 Xcode command line tools 來安裝即可。


二、Homebrew

Homebrew 是 Mac 上最受歡迎的[包管理工具]

!在此之前,必須保證 Xcode command line tools

安裝命令

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安裝完成之后將 Homebrew 的可執(zhí)行命令添加到環(huán)境變量中

$ echo 'export PATH="/usr/local/bin:$PATH"' >>? ~/.bash_profile

簡單使用

1、$ brew install?# 安裝包

2、$ brew update# 更新包目錄

3、$ brew outdated# 查看需要更新的包

4、$ brew upgrade?# 更新包

5、$ brew list# 查看已安裝的包


三、Homebrew Cask

相當于homebrew上面的一個擴展,裝這個之后,能安裝大部分有界面的軟件,如QQ,teamviewer這種。?

其實不安裝也可以安裝那些軟件,但是要麻煩一些。輸入軟件之前要先搜索出軟件的路徑,一般都在caskroom下面。。?

安裝命令:

brew tap caskroom/cask

2021 update

brew tap caskroom/cask => brew tap homebrew/cask



四、zsh

被譽為終極終端的終端。在bash的基礎(chǔ)上改進了一些實用的功能。詳細(中文)介紹請戳這里。

mac中自帶zsh,但是好像不是最新版本,所以我用brew install zsh升級了一下。

但是這個時候你的iTerm2用的還是原來系統(tǒng)自帶的bash,這個時候可以輸入以下命令切換成zsh:

chsh -s /bin/zsh


五、oh-my-zsh

當然你肯定還需要這個好用的綜合管理工具,讓你的終端更高效。

安裝命令:

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

安裝完成后編輯.zshrc,將source指向.bash_profile

# source

source ~/.bash_profile

.zshrc的其他配置將與其他環(huán)境安裝同步進行


六、liunx命令別名

由于mac無法使用liunx下的ll,la,l等命令,故將其設(shè)置為別名方便操作

編輯.zshrc,添加以下內(nèi)容:

# linux

alias ll='ls -alF'

alias la='ls -A'

alias l='ls -CF'

當然了,還可以根據(jù)你個人習慣添加更多

alias cls='clear'

alias ll='ls -l'

alias la='ls -a'

alias vi='vim'

alias javac="javac -J-Dfile.encoding=utf8"

alias grep="grep --color=auto"

alias -s html=mate? # 在命令行直接輸入后綴為 html 的文件名,會在 TextMate 中打開

alias -s rb=mate? ? # 在命令行直接輸入 ruby 文件,會在 TextMate 中打開

alias -s py=vi? ? ? # 在命令行直接輸入 python 文件,會用 vim 中打開,以下類似

alias -s js=vi

alias -s c=vi

alias -s java=vi

alias -s txt=vi

alias -s gz='tar -xzvf'

alias -s tgz='tar -xzvf'

alias -s zip='unzip'

alias -s bz2='tar -xjvf'



七、nvm

nvm作為node的版本管理工具當然必不可少

go: https://github.com/creationix/nvm

get install:找到Install script模塊,找到安裝命令如:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh|bash

(ps:版本號根據(jù)你處的時代不同而變化,enjoy)

安裝完成后將nvm環(huán)境變量添加到.zshrc中:

# nvm

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


八、Node

通過剛才裝的nvm安裝nodejs

nvm use:

nvm install node? ? ? ? ? #? "node" is an alias for the latest version(安裝最新版本node)

nvm install?v11.10.0? ? #? 安裝指定版本node

nvm uninstall v11.10.0? ? #? 卸載指定版本node

nvm use?v11.10.0? ? ? ?#? 使用指定版本node

nvm ls? ? #? 查看安裝的node版本列表

nvm --version? ? #? 查看安裝的nvm版本號

安裝完成之后查看node版本號:

node -v? ? ?#? 如有則說明安裝成功,如需切換請使用nvm use


九、npm

npm是跟隨node一起安裝的

升級npm請使用

npm install npm -g

ps:npm日常使用命令不在此篇討論范圍內(nèi)


十、nrm

nrm是一個npm源管理器,允許你快速切換npm源

此時可以使用nvm將node切換到你想要版本下

全局安裝nrm:

npm install -g nrm

nrm use:

nrm --version? ?#? 查看nrm版本號

nrm ls? ?#? 查看當前源列表

nrm use ***(cnpm)? ? #? 切換到某個源

nrm add ***(源名,如:snpm) ***(源地址,如:http://registry.npm.souche-inc.com/)? ? #? 添加某個源

nrm del ***(源名:snpm)? ? ?#? 刪除某個源

nrm test ***(源名:npm)? ?#? 測試某個源的速度


十一、yarn

同樣的此時可以使用nvm將node切換到你想要版本下(如已在請忽略)

全局安裝yarn:

npm install -g yarn

yarn use:

yarn -v? ? ? ? ?#? 查看安裝的yarn版本號

yarn config get registry? ? ? ? #? 查看當前yarn設(shè)置的源

yarn config set registry ***(http://registry.npm.souche-inc.com)? ? #? 設(shè)置源

?。?!當nrm或yarn其中一個設(shè)置源之后,兩者同時生效切換

可以將查看命令添加到zsh的alias快捷操作中

# yarn

# 查看當前源

alias yarn-cget='yarn config get registry'

這樣你就可以通過yarn-cget命令快速查看當前yarn設(shè)置的源啦,enjoy

ps:yarn日常使用命令不在此篇討論范圍內(nèi)


十二、安裝3個讓你更加高效的zsh輔助

他們就是autojump、zsh-autosuggestions、zsh-syntax-highlighting

首先來看autojump,這是一個能夠讓你在shell中快捷跳轉(zhuǎn)打開文件或目錄的插件

操作:光標停留在shell上想要open的文件上方,command + click即可open

安裝:

brew install autojump

設(shè)置環(huán)境變量到.zshrc:

# autojump

[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh

source /Users/dasouche/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh


再來是zsh-autosuggestions,自動提示補全你的歷史命令

安裝:

git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions


最后是zsh-syntax-highlighting,自動高亮可用命令及警告錯誤的命令

安裝:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting


3個插件都安裝完成之后,將3個插件添加到oh-my-zsh的plugins中

編輯.zshrc,找到

# Which plugins would you like to load?

# Standard plugins can be found in ~/.oh-my-zsh/plugins/*

# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/

# Example format: plugins=(rails git textmate ruby lighthouse)

# Add wisely, as too many plugins slow down shell startup.

plugins=(git ...plugins)

在最后這行添加剛才安裝的3個查看 ==>

plugins=(git autojump zsh-autosuggestions zsh-syntax-highlighting)



十三、vscode

go vscode官網(wǎng)下載并安裝

13.1、漢化:

shift+command+p打開命令面板輸入language選擇Configure display language(配置顯示語言)

在打開的locale.json文件中修改locale字段為zh-CN,保存

在擴展中搜索Chinese,找到Chinese (Simplified) Language Pack for Visual Studio Code,安裝

ok,perfect!


13.2、規(guī)范

雙空格為一個tab

在用戶設(shè)置json(首選項-設(shè)置)中添加

"editor.tabSize": 2


13.3、插件

Beautify? ? ?#? 美化代碼

Bracket Pair Colorizer? ? ?#? 不同顏色的清晰括號

ESLint? ? ?#? 不解釋了

TSLint? ? ?#? 不解釋了

GitLens — Git supercharged? ? ?#? ?查看每一行代碼的git提交記錄,讓讓你加班的人無所遁形

HTML CSS Support? ? ? #? ?html,css自動補全等,在用戶設(shè)置json(首選項-設(shè)置)中添加

"editor.parameterHints": true,

"editor.quickSuggestions": {

? ? "other": true,

? ? "comments": true,

? ? "strings": true

}

koroFileHeader? ? ? ?#? 快捷注釋,在用戶設(shè)置json(首選項-設(shè)置)中添加

"fileheader.customMade": { // 頭部注釋

? ? ? "Description": "Settings Edit",

? ? ? "Author": "zsc",

? ? ? "Date": "Do not edit", // 文件創(chuàng)建時間(不變)

? ? ? "LastEditors": "zsc", // 文件最后編輯者

? ? ? "LastEditTime": "Do not edit" // 文件最后編輯時間

? ? },

? ? "fileheader.cursorMode": {? // 函數(shù)注釋

? ? ? "description": "描述",

? ? ? "param": "`參數(shù)名` `參數(shù)描述`",

? ? ? "success": "{string}",

? ? ? "failure": "{object}"

? ? },

? ? "fileheader.configObj": {? // 注釋配置

? ? ? "createFileTime": true, // 默認為此文件的創(chuàng)建時間,設(shè)為false更改為當前生成注釋的時間

? ? },

koroFileHeader快捷鍵使用:

在文件頭部添加注釋:window:ctrl+alt+i, mac:ctrl+cmd+i

在光標處添加函數(shù)注釋:window:ctrl+alt+t, mac:ctrl+cmd+t

markdownlint? ? ?#? ?建立良好的markdown規(guī)范,優(yōu)化你的md文件

npm Intellisense? ? ? #? ?貌似新版vscode已經(jīng)集成了

Path Intellisense? ? ?#? ?還在為import文件路徑煩惱?

Sublime Text Keymap and Settings Importer? ?#? 如果你更習慣sublime的操作的話

Vetur? ? ?#? ?vue開發(fā)者必備

VSCode Great Icons? ? ? #? ?美麗的icon也讓心情更美麗,請在在用戶設(shè)置json(首選項-設(shè)置)中添加

"workbench.iconTheme": "vscode-great-icons"

VueHelper? ? #? ?嗯,語法提示

ES7 React/Redux/GraphQL/React-Native snippets? ? ?#? ?as short as fast

React Native Tools? ? ?#? ?for RN

...more as you like


13.4、語法支持

js、jsx文件中自動補全html

在用戶設(shè)置json(首選項-設(shè)置)中添加

"emmet.includeLanguages": {

? ? "vue-html": "html",

? ? "javascript": "javascriptreact"

},


13.5、主題

shift+command+p打開命令面板輸入theme找到Color Theme(主題顏色),選擇Monokai或者你喜歡的都ok

在擴展中也可以搜索你喜歡的主題,擴展主題安裝后請在用戶設(shè)置json(首選項-設(shè)置)中添加

"workbench.colorTheme": "xxx"


over

enjoy

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容