Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac OS 使用记录 #36

Open
giscafer opened this issue Jan 30, 2020 · 0 comments
Open

Mac OS 使用记录 #36

giscafer opened this issue Jan 30, 2020 · 0 comments
Labels

Comments

@giscafer
Copy link
Owner

giscafer commented Jan 30, 2020

软件


开发

之前一直用公司的 Mac , 环境直接安装没啥问题,自己入手的 mbp 就遇到一些问题,记录一下。

shell scripts 包管理器

Basher 允许您直接从 github(或其他站点)快速安装 shell 软件包。 basher 无需为每个软件包寻找特定的安装说明并弄乱您的路径,而是将为所有软件包创建一个中心位置并为您管理其二进制文件。

https://github.com/basherpm/basher

Terminal 总是要输入用户密码,或者 npm install 总需要 sudo 权限

sudo vi /etc/sudoers
找到:
# root and users in group wheel can run anything on any machine as any user
root        ALL = (ALL) ALL
%admin      ALL = (ALL) ALL
 
修改为:
# root and users in group wheel can run anything on any machine as any user
#root       ALL = (ALL) ALL
#%admin     ALL = (ALL) ALL
root            ALL = (ALL) NOPASSWD: NOPASSWD: ALL
%admin          ALL = (ALL) NOPASSWD: NOPASSWD: ALL
  • 可以通过配置免密的方式解除 sudo (存在风险)

修改 ~/.bash_profile 文件环境变量& source 了也不生效

Terminal 可能使用的是 zsh (看终端title是否有这个后缀),zsh加载的是 ~/.zshrc文件,而 ‘.zshrc’ 文件中并没有定义任务环境变量

  • vim ~/.zshrc 创建文件
  • ~/.zshrc 文件最后,增加一行:source ~/.bash_profile
  • 执行命令,使其立即生效 source ~/.zshrc

各环境文件补充说明:MAC OSX环境变量$PATH

使用 rmtrash 替代 rm -rf

避免误删文件无法恢复

brew install rmtrash
echo "alias rm='rmtrash'" >> ~/.bash_profile
source ~/.bash_profile

gyp: No Xcode or CLT version detected!

gyp: No Xcode or CLT version detected macOS Catalina | Anansewaa

sudo rm -rf $(xcode-select -print-path)
xcode-select --install

VPN 全局代理

1.bash_profile Alias

alias proxy='export https_proxy=http://127.0.0.1:1087 export http_proxy=http://127.0.0.1:1087  export all_proxy=socks5://127.0.0.1:1087'
alias unproxy='unset https_proxy unset http_proxy unset all_proxy'
alias ip='curl cip.cc'

bash_profile 设置加入HTTP 和 HTTPS

2.ClashX 配置文件

在ClashX的配置文件中加入 - 'DOMAIN-SUFFIX,cip.cc,Proxy'
这一步的设置是可以走规则判断,不用使用全局模式

@giscafer giscafer added the Tool label Feb 23, 2020
@giscafer giscafer pinned this issue Mar 16, 2020
@giscafer giscafer unpinned this issue Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant