logo头像
Snippet 博客主题

mac 常用命令和常用环境搭建

由于mac没有内存了就抹掉重新安装了一下,所以重新安装所有环境记录一下

git 配置

git config -l 查看一下配置
git config –global user.email “you@example.com
git config –global user.name “Your Name”

快捷键

  • 显示隐藏文件

    cmd shift + .

  • 编辑文件

    vim test.txt
    i或o进入编辑模式
    esc 退出编辑模式
    :wq保存退出

  • 查看路径

    pwd

  • 查看文件

    ls -a

常用位置

驱动所在位置: /Systme/Library/Extensions
用户文件夹位置:/User/用户名,可以用波浪号()表示
桌面位置:/User/用户名/Desktop,可以用
/Desktop表示
配置环境变量 : open .bash_profile

HomeBrew 安装

1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

遇到错误

1
2
3
4
5
6
7
8
9
remote: Enumerating objects: 82, done.
remote: Counting objects: 100% (82/82), done.
remote: Compressing objects: 100% (52/52), done.
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core` exited with 128.
Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1.

这个错误是因为项目太久,tag资源文件太大。
我尝试了一下网上的 git config –add core.compression -1
没啥用

1
2
3
4
cd /usr/local/Homebrew/Library/Taps/
mkdir homebrew
cd homebrew
git clone https://mirrors.ustc.edu.cn/homebrew-core.git

brew update

1
2
3
4
5
6
7
8
Cloning into 'homebrew-core'...
remote: Enumerating objects: 844349, done.
remote: Total 844349 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (844349/844349), 331.89 MiB | 4.36 MiB/s, done.
Resolving deltas: 100% (570934/570934), done.
Updating files: 100% (5617/5617), done.
liufeng@liuliufengdeMacBook-Pro homebrew % brew update
Already up-to-date.

npm安装

npm是基于nodejs的包管理器
从npm服务器下载别人的编写的第三方包、模块到本地使用。
从npm服务器下载安装别人编写的命令行程序到本地使用。
将自己写的包、模块或者着命令行程序上传到npm服务器,共别人下载使用。

安装node

brew install node

npm 升级

npm是随着nodejs安装一并安装的。 更新npm,可以用npm命令。
sudo npm install npm -g

hexo

npm install -g hexo-cli

微信打赏

赞赏是不耍流氓的鼓励