New Mac Develop Setup
- node
- cnpm
- git
- terminal
Install Node
- Download NodeJS from https://npmmirror.com/
- Unzip to
~/bin
- link it
$ cd ~/bin
$ ln -s ./node-v18.4.0-darwin-x64/bin/node ./node
$ ln -s ./node-v18.4.0-darwin-x64/bin/npm ./npm
$ ln -s ./node-v18.4.0-darwin-x64/bin/npx ./npx
- install cnpm
$ npm install -g cnpm --registry=https://registry.npmmirror.com
# install global will located in your own node path
# so we need link it too
$ ln -s ./node-v18.4.0-darwin-x64/bin/cnpm ./cnpm
Terminal
$ vi ~/.bash_profile
OR touch ~/.bash_profile
$ echo "PATH=~/bin:$PATH" > ~/.bash_profile
As Mac use zsh
by default, so we need add source ~/.bash_profile
to ~/.zshrc
$ vi ~/.zshrc
$ echo "source ~/.bash_profile" > ~/.zshrc
Git
-
Install Git by git-scm
- You can’t push your code by
HTTPS
, so you have to push it bySSH
- First of all, create your own SSH-KEY, new ssh-key
$ ssh-keygen -t ed25519 -C "your_email@example.com"
-
add
~/.ssh/id_ed25519.pub
to https://github.com/settings/keys
$ git remote set-url origin git@github.com:USERNAME/REPOSITORY.git
Github
Speed up your github by hosts and use hosts tool like switchhosts
or simply
$ sudo vi /etc/hosts
$ echo "140.82.112.3 github.com" >> /etc/hosts