---
title: "mac开始工作步骤"
author: "xiaomiya"
date: "2020-07-15T16:15:04Z"
tags: []
categories: ["Web前端"]
slug: "mac"
draft: false
lastmod: "2020-07-15T16:15:04Z"
id: 2515674
url: "https://xiaomiya.iteye.com/blog/2515674"
---

1，链接网络（第一步：访问 https：xxxx，申请个人电脑入网。）

====申请完成之后，需要联系阿里主管，阿里主管和阿里安全接口人批准入网申请。====

2，下载阿里郎（通过以下链接在电脑上下载安装阿里郎：

[https:](https://alilang.alibaba-inc.com/portal/index.htm)xxx。）

===所有在家远程办公的生态用工小二必须签署保密协议，协议地址（注：在阿里郎登陆状态下才能签署）：https://[x](https://yida.alibaba-inc.com/s//123#/)xx

安装完成后通过阿里郎VPN接入内网，即可以像在办公室一样办公了。====

领导会提前让签署的。

3，用阿里郎下载云壳,谷歌,钉钉,ihost，赛门铁壳等等，启动项目需要jdk，

4，安装node，安装git

node下载: [https://nodejs.org/en/](https://nodejs.org/en/)

（node 的中文网站下载更快）

[http://nodejs.cn/download/](http://nodejs.cn/download/)

 

git安装：

git下载: [https://git-scm.com/](https://git-scm.com/)

(或者直接git 回车 ，，，，弹出安装)

 

6，（项目需要）

sudo npm install --registry=[https://registry.npm.alibaba-inc.com](https://registry.npm.alibaba-inc.com/) -g tnpm

sudo tnpm install @ali/gfun-cli -g

 

7，可以看看：[https://yuque.antfin-inc.com/ziyuan.tzy/gpkr28/xevtew](https://yuque.antfin-inc.com/ziyuan.tzy/gpkr28/xevtew)

 

5，安装vscode（可以下载也可以让同事发安装包）

vscode要安装插件及配置setting，另外安装zsh，用起来更舒服

插件图如下：

![image.png](https://intranetproxy.alipay.com/skylark/lark/0/2020/png/162459/1581823717952-08ce7107-e229-4c3b-b7dc-e9883f0656b6.png "image.png")

![image.png](https://intranetproxy.alipay.com/skylark/lark/0/2020/png/162459/1581823724056-be4e6c9e-f64e-48f1-8a10-5f0a1092a0e3.png "image.png")

配置如下：

 

{

 "window.zoomLevel": 0,

 "editor.fontSize": 14,

 "editor.tabSize": 2,

 "editor.suggestSelection": "first",

 "editor.foldingStrategy": "indentation",

 "files.autoSave": "onFocusChange",

 "prettier.semi": true,

 "prettier.singleQuote": true,

 "prettier.trailingComma": "es5",

 "git.confirmSync": false,

 "git.enableSmartCommit": true,

 "explorer.confirmDelete": false,

 "explorer.confirmDragAndDrop": false,

 "breadcrumbs.enabled": true,

 "workbench.startupEditor": "newUntitledFile",

 "javascript.updateImportsOnFileMove.enabled": "always",

 "javascript.implicitProjectConfig.experimentalDecorators": true,

 "emmet.triggerExpansionOnTab": true,

 "emmet.includeLanguages": {

   "javascript": "javascriptreact"

 },

 "terminal.integrated.rendererType": "dom",

 "terminal.integrated.shell.osx": "/bin/zsh",

 "liveServer.settings.donotShowInfoMsg": true,

 "python.jediEnabled": false,

 "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",

 "\[javascript]": {

   "editor.defaultFormatter": "esbenp.prettier-vscode"

 },

 "\[html]": {

   "editor.defaultFormatter": "esbenp.prettier-vscode"

 },

 "\[vue]": {

   "editor.defaultFormatter": "esbenp.prettier-vscode"

 },

 "\[json]": {

   "editor.defaultFormatter": "esbenp.prettier-vscode"

 },

 "\[typescript]": {

   "editor.defaultFormatter": "esbenp.prettier-vscode"

 },

 "html.format.wrapLineLength": 180,

 "editor.codeActionsOnSave": {

   "source.fixAll.eslint": true

 },

}

 

完成之后要重新vscode才会生效

 

5，安装zsh

方法1：sh install.sh

文件install.sh

#!/bin/sh

\#

\# This script should be run via curl:

\#   sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

\# or wget:

\#   sh -c "$(wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

\#

\# As an alternative, you can first download the install script and run it afterwards:

\#   wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh

\#   sh install.sh

\#

\# You can tweak the install behavior by setting variables when running the script. For

\# example, to change the path to the Oh My Zsh repository:

\#   ZSH=~/.zsh sh install.sh

\#

\# Respects the following environment variables:

\#   ZSH     - path to the Oh My Zsh repository folder (default: $HOME/.oh-my-zsh)

\#   REPO    - name of the GitHub repo to install from (default: ohmyzsh/ohmyzsh)

\#   REMOTE  - full remote URL of the git repo to install (default: GitHub via HTTPS)

\#   BRANCH  - branch to check out immediately after install (default: master)

\#

\# Other options:

\#   CHSH    - 'no' means the installer will not change the default shell (default: yes)

\#   RUNZSH  - 'no' means the installer will not run zsh after the install (default: yes)

\#

\# You can also pass some arguments to the install script to set some these options:

\#   --skip-chsh: has the same behavior as setting CHSH to 'no'

\#   --unattended: sets both CHSH and RUNZSH to 'no'

\# For example:

\#   sh install.sh --unattended

\#

set -e

 

\# Default settings

ZSH=${ZSH:-~/.oh-my-zsh}

REPO=${REPO:-ohmyzsh/ohmyzsh}

REMOTE=${REMOTE:-https://github.com/${REPO}.git}

BRANCH=${BRANCH:-master}

 

\# Other options

CHSH=${CHSH:-yes}

RUNZSH=${RUNZSH:-yes}

 

 

command\_exists() {

 command -v "$@" &gt;/dev/null 2&gt;&1

}

 

error() {

 echo ${RED}"Error: $@"${RESET} &gt;&2

}

 

setup\_color() {

 # Only use colors if connected to a terminal

 if \[ -t 1 ]; then

   RED=$(printf '\\033[31m')

   GREEN=$(printf '\\033[32m')

   YELLOW=$(printf '\\033[33m')

   BLUE=$(printf '\\033[34m')

   BOLD=$(printf '\\033[1m')

   RESET=$(printf '\\033[m')

 else

   RED=""

   GREEN=""

   YELLOW=""

   BLUE=""

   BOLD=""

   RESET=""

 fi

}

 

setup\_ohmyzsh() {

 # Prevent the cloned repository from having insecure permissions. Failing to do

 # so causes compinit() calls to fail with "command not found: compdef" errors

 # for users with insecure umasks (e.g., "002", allowing group writability). Note

 # that this will be ignored under Cygwin by default, as Windows ACLs take

 # precedence over umasks except for filesystems mounted with option "noacl".

 umask g-w,o-w

 

 echo "${BLUE}Cloning Oh My Zsh...${RESET}"

 

 command\_exists git || {

   error "git is not installed"

   exit 1

 }

 

 if \[ "$OSTYPE" = cygwin ] && git --version | grep -q msysgit; then

   error "Windows/MSYS Git is not supported on Cygwin"

   error "Make sure the Cygwin git package is installed and is first on the \\$PATH"

   exit 1

 fi

 

 git clone -c core.eol=lf -c core.autocrlf=false \\

   -c fsck.zeroPaddedFilemode=ignore \\

   -c fetch.fsck.zeroPaddedFilemode=ignore \\

   -c receive.fsck.zeroPaddedFilemode=ignore \\

   --depth=1 --branch "$BRANCH" "$REMOTE" "$ZSH" || {

   error "git clone of oh-my-zsh repo failed"

   exit 1

 }

 

 echo

}

 

setup\_zshrc() {

 # Keep most recent old .zshrc at .zshrc.pre-oh-my-zsh, and older ones

 # with datestamp of installation that moved them aside, so we never actually

 # destroy a user's original zshrc

 echo "${BLUE}Looking for an existing zsh config...${RESET}"

 

 # Must use this exact name so uninstall.sh can find it

 OLD\_ZSHRC=~/.zshrc.pre-oh-my-zsh

 if \[ -f ~/.zshrc ] || \[ -h ~/.zshrc ]; then

   if \[ -e "$OLD\_ZSHRC" ]; then

     OLD\_OLD\_ZSHRC="${OLD\_ZSHRC}-$(date +%Y-%m-%d\_%H-%M-%S)"

     if \[ -e "$OLD\_OLD\_ZSHRC" ]; then

       error "$OLD\_OLD\_ZSHRC exists. Can't back up ${OLD\_ZSHRC}"

       error "re-run the installer again in a couple of seconds"

       exit 1

     fi

     mv "$OLD\_ZSHRC" "${OLD\_OLD\_ZSHRC}"

 

     echo "${YELLOW}Found old ~/.zshrc.pre-oh-my-zsh." \\

       "${GREEN}Backing up to ${OLD\_OLD\_ZSHRC}${RESET}"

   fi

   echo "${YELLOW}Found ~/.zshrc.${RESET} ${GREEN}Backing up to ${OLD\_ZSHRC}${RESET}"

   mv ~/.zshrc "$OLD\_ZSHRC"

 fi

 

 echo "${GREEN}Using the Oh My Zsh template file and adding it to ~/.zshrc.${RESET}"

 

 cp "$ZSH/templates/zshrc.zsh-template" ~/.zshrc

 sed "/^export ZSH=/ c\\\\

export ZSH=\\"$ZSH\\"

" ~/.zshrc &gt; ~/.zshrc-omztemp

 mv -f ~/.zshrc-omztemp ~/.zshrc

 

 echo

}

 

setup\_shell() {

 # Skip setup if the user wants or stdin is closed (not running interactively).

 if \[ $CHSH = no ]; then

   return

 fi

 

 # If this user's login shell is already "zsh", do not attempt to switch.

 if \[ "$(basename "$SHELL")" = "zsh" ]; then

   return

 fi

 

 # If this platform doesn't provide a "chsh" command, bail out.

 if ! command\_exists chsh; then

   cat &lt;&lt;-EOF

     I can't change your shell automatically because this system does not have chsh.

     ${BLUE}Please manually change your default shell to zsh${RESET}

   EOF

   return

 fi

 

 echo "${BLUE}Time to change your default shell to zsh:${RESET}"

 

 # Prompt for user choice on chang ing the default login shell

 printf "${YELLOW}Do you want to change your default shell to zsh? \[Y/n]${RESET} "

 read opt

 case $opt in

   y\*|Y\*|"") echo "Changing the shell..." ;;

   n\*|N\*) echo "Shell change skipped."; return ;;

   \*) echo "Invalid choice. Shell change skipped."; return ;;

 esac

 

 # Check if we're running on Termux

 case "$PREFIX" in

   \*com.termux\*) termux=true; zsh=zsh ;;

   \*) termux=false ;;

 esac

 

 if \[ "$termux" != true ]; then

   # Test for the right location of the "shells" file

   if \[ -f /etc/shells ]; then

     shells\_file=/etc/shells

   elif \[ -f /usr/share/defaults/etc/shells ]; then # Solus OS

     shells\_file=/usr/share/defaults/etc/shells

   else

     error "could not find /etc/shells file. Change your default shell manually."

     return

   fi

 

   # Get the path to the right zsh binary

   # 1. Use the most preceding one based on $PATH, then check that it's in the shells file

   # 2. If that fails, get a zsh path from the shells file, then check it actually exists

   if ! zsh=$(which zsh) || ! grep -qx "$zsh" "$shells\_file"; then

     if ! zsh=$(grep '^/.\*/zsh$' "$shells\_file" | tail -1) || \[ ! -f "$zsh" ]; then

       error "no zsh binary found or not present in '$shells\_file'"

       error "change your default shell manually."

       return

     fi

   fi

 fi

 

 # We're going to change the default shell, so back up the current one

 if \[ -n "$SHELL" ]; then

   echo $SHELL &gt; ~/.shell.pre-oh-my-zsh

 else

   grep "^$USER:" /etc/passwd | awk -F: '{print $7}' &gt; ~/.shell.pre-oh-my-zsh

 fi

 

 # Actually change the default shell to zsh

 if ! chsh -s "$zsh"; then

   error "chsh command unsuccessful. Change your default shell manually."

 else

   export SHELL="$zsh"

   echo "${GREEN}Shell successfully changed to '$zsh'.${RESET}"

 fi

 

 echo

}

 

main() {

 # Run as unattended if stdin is closed

 if \[ ! -t 0 ]; then

   RUNZSH=no

   CHSH=no

 fi

 

 # Parse arguments

 while \[ $# -gt 0 ]; do

   case $1 in

     --unattended) RUNZSH=no; CHSH=no ;;

     --skip-chsh) CHSH=no ;;

   esac

   shift

 done

 

 setup\_color

 

 if ! command\_exists zsh; then

   echo "${YELLOW}Zsh is not installed.${RESET} Please install zsh first."

   exit 1

 fi

 

 if \[ -d "$ZSH" ]; then

   cat &lt;&lt;-EOF

     ${YELLOW}You already have Oh My Zsh installed.${RESET}

     You'll need to remove '$ZSH' if you want to reinstall.

   EOF

   exit 1

 fi

 

 setup\_ohmyzsh

 setup\_zshrc

 setup\_shell

 

 printf "$GREEN"

 cat &lt;&lt;-'EOF'

            \__                                     \__

     \_\_\__  / /_     \_\_\__ \_\__  \__  \__   \_\_\__  \_\_\_\_\_/ /_

    / \__ \\/ \__ \\   / \__ \`\__ \\/ / / /  /_  / / \_\_\_/ \__ \\

   / /\_/ / / / /  / / / / / / /\_/ /    / /\_(\__  ) / / /

   \\\_\_\_\_/\_/ /\_/  /\_/ /\_/ /\_/\\\_\_, /    /\_\_\_/\_\_\_\_/\_/ /\_/

                           /\_\_\_\_/                       ....is now installed!

 

 

   Please look over the ~/.zshrc file to select plugins, themes, and options.

 

   p.s. Follow us on https://twitter.com/ohmyzsh

 

   p.p.s. Get stickers, shirts, and coffee mugs at https://shop.planetargon.com/collections/oh-my-zsh

 

 EOF

 printf "$RESET"

 

 if \[ $RUNZSH = no ]; then

   echo "${YELLOW}Run zsh to try it out.${RESET}"

   exit

 fi

 

 exec zsh -l

}

 

main "$@"

 

 

 

shell神器

 

首先安装 git，安装方式同上，把 zsh 换成 git 即可。

安装「oh my zsh」可以自动安装也可以手动安装。

自动安装：

wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

手动安装：

git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh

cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc