Skip to content

Mac 实用技巧 #27

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

Open
pfan123 opened this issue Feb 27, 2019 · 0 comments
Open

Mac 实用技巧 #27

pfan123 opened this issue Feb 27, 2019 · 0 comments

Comments

@pfan123
Copy link
Owner

pfan123 commented Feb 27, 2019

Mac 每次都要执行source ~/.bash_profile 配置的环境变量才生效

~/.bash_profile 中配置环境变量, 可是每次重启终端后配置的不生效.需要重新执行 : $source ~/.bash_profile

例如设置 cairo 环境变量

For compilers to find libffi you may need to set:
  export LDFLAGS="-L/usr/local/opt/libffi/lib"

For pkg-config to find libffi you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

# 编译c语言
gcc -o cairotest $(pkg-config --cflags --libs cairo) cairotest.c

发现zsh加载的是 ~/.zshrc 文件,而 .zshrc 文件中并没有定义任务环境变量。

解决办法

~/.zshrc 文件最后,增加一行:

ssh source ~/.bash_profile

Mac 系统调整 Launchpad 应用程序图标大小

运行“终端”程序,执行以下命令:

1.调整每一列显示图标数量,7 表示每一列显示7个,在我的电脑上,7个个人觉得比较不错

defaults write com.apple.dock springboard-rows -int 7

2.调整每一行显示图标数量,这里我用的是8

defaults write com.apple.dock springboard-columns -int 8

3.由于修改了每一页显示图标数量,可能需要重置Launchpad

defaults write com.apple.dock ResetLaunchPad -bool TRUE;killall Dock

macOS Catalina 10.15 第三方软件文件提示已损坏解决办法

sudo xattr -r -d com.apple.quarantine  [Application path]
// 例如 Sketch
sudo xattr -r -d com.apple.quarantine /Applications/Sketch.app/

使用【Finder】的【显示】设置显示完整路径

打开【Finder】,找到菜单栏中的【显示】->【显示路径栏】,或者使用快捷键【option+command+p】显示路径栏。

设置【VS code】alias 快捷键

设置 alias

alias code="/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code"

vi ~/.zshrc 添加

source ~/.bash_profile

解决 vscode 使用 Powerline 乱码问题

settings.json 设置:

{
    "terminal.integrated.fontFamily": "Source Code Pro for Powerline"
}
// or
{
    "terminal.external.osxExec": "iTerm.app",
    "terminal.integrated.shell.osx": "/bin/zsh",
    "terminal.integrated.fontFamily": "Menlo for Powerline"
}

解决 vscode 重置 ESLint 对话选择判定

ESLint Extension 升级后,启动新 workspace 会弹窗提示选择是否选择本地 node_modules/eslint,但有时候我们选择 NO 之后,如何重置选择呢?

"The eslint extension will use the eslint library node_modules/eslint installed locally to the workspace folder 'reponame' for validation. Do you allow this?"

我们可以 command+shift+p 打开命令窗口,输入:

ESLint: Reset Library Decisions  // 重置选择判定
ESLint: Create ESLint configuration 
ESLint: Disable ESLint
ESLint: Enable ESLint
ESLint: Fix all auto-fixable Problems
ESLint: Migrate Settings
ESLint: Show Output Channel
@pfan123 pfan123 changed the title Mac 每次都要执行source ~/.bash_profile 配置的环境变量才生效 Mac 实用技巧 Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant