Mac安装工具汇总

安装ssh

1.电脑打开远程共享

系统偏好设置-共享
在这里插入图片描述

2.生成秘钥

ssh-keygen -t rsa

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

3.验证

ssh localhost

HomeBrow

1. 安装

国外:

官网:https://brew.sh/index_zh-cn
下载:/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)”

国内镜像(推荐)

/bin/zsh -c “$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)”
1.选择中科院
2.输入密码

2. 镜像加速

使用国内的镜像替换homebrew镜像,对镜像进行加速源

执行brew命令安装的时候,跟3个仓库地址有关

  • brew.git

  • homebrew-core.git

  • homebrew-bottles

步骤1: 把三个仓库地址全部替换成国内Alibaba提供的地址

	brew.git 仓库地址:
	cd "$(brew --repo)"
	git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
	 
	
	homebrew-core.git仓库地址
	cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
	git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git

步骤2:替换homebrew-bottles,首先查看shell版本,执行 echo $SHELL

  • zsh终端操作方式
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
  • bash终端操作方式
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

npm

brew install node

关闭Rootless

Rootless 苹果从 OS X El Capitan 10.11 系统开始使用了 Rootless 机制,系统默认将会锁定 /system、/sbin、/usr 这三个目录。用户要获取这三个目录的写权限,需要关闭Rootless

  • 重启 Mac,开机时后按下Command+R,进入恢复模式。
  • 在上面的菜单实用工具中找到并打开 Terminal
  • 输入如下命令:csrutil disable
  • 重启MAC,给/system、/sbin、/usr授权
    • sudo chown -R $(whoami) /usr/local

home目录权限修改

  1. 编译 /etc/auto_master 文件

    注释掉或者移除以 /home 开头的一行

    nano /etc/auto_master
    

    在这里插入图片描述

  2. 使配置生效

    cd /     # 进入到根目录
    sudo automount -vc
    
  3. 验证

    cd /home                   		 # 进入到home目录
    sudo mkdir 你的目录            	 # 创建work目录
    chmod 777 -R 你的目录          	 # 修改读写权限
    chown work:work  你的目录		·# 修改所属组为work
    

猜你喜欢

转载自blog.csdn.net/dabaoting/article/details/114606405