Mac

date
Dec 23, 2021
slug
mac
status
Published
tags
Mac
summary
Mac
type
Post

Mac下常见的问题

聚焦无法搜索到软件

# 1.关闭聚焦(spotlight)
sudo mdutil -a -i off
# 2.不加载控制聚焦参数的文件
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
# 3.重新加载控制聚焦参数的文件
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
# 4.打开聚焦
sudo mdutil -a -i on

损坏无法打开

sudo xattr -d com.apple.quarantine /Applications/Charles.app
sudo xattr -d com.apple.quarantine /Applications/xx.app
sudo chown -R root "/Applications/Charles.app/Contents/Resources"
sudo chmod -R u+s "/Applications/Charles.app/Contents/Resources"

NTFS挂载

diskutil info /Volumes/My\ Passport
hdiutil eject /Volumes/My\ Passport
sudo mkdir ~/MyPassport
sudo mount_ntfs -o rw,nobrowse /dev/disk4s1 ~/MyPassport

权限问题

sudo chown -R $(whoami) /usr/local/lib
sudo chown -R $(whoami) /usr/local/bin
 
多版本jdk vim ./bash_profile
# JDK 配置
export JAVA_8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home
export JAVA_11_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home
export JAVA_17_HOME=/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home

# 默认JDK版本
export JAVA_HOME=$JAVA_8_HOME

# 多版本切换(取了别名,更方便切换)
alias jdk8="export JAVA_HOME=$JAVA_8_HOME"
alias jdk11="export JAVA_HOME=$JAVA_11_HOME"
alias jdk17="export JAVA_HOME=$JAVA_17_HOME"
 

Nginx

brew install nginx
nginx安装文件目录 /usr/local/Cellar/nginx
nginx配置文件目录 /usr/local/etc/nginx
config文件目录 /usr/local/etc/nginx/nginx.conf
系统hosts位置 /private/etc/hosts

© WangJiaHao 2022