Mac常用到的命令

Mac常用到的命令

六月 30, 2019

Mac常用到的命令


  1. 隐藏“允许任何来源的应用”选项问题:

sudo spctl –master-disable

  1. 重建缓存的命令

打开终端,输入命令:

#!/bin/sh

sudo chmod -Rf 755 /S/L/E*

sudo chown -Rf 0:0 /S/L/E*

sudo chmod -Rf 755 /L/E

sudo chown -Rf 0:0 /L/E

sudo rm -Rf /S/L/PrelinkedKernels/*

sudo rm -Rf /S/L/Caches/com.apple.kext.caches/*

sudo touch -f /S/L/E*

sudo touch -f /L/E

sudo kextcache -Boot -U /

  1. 磁盘分区的基本操作:教你将U盘上的EFI复制到磁盘的EFI分区

查看磁盘分区表:diskutil list

挂载磁盘EFI分区: diskutil mount disk0s1

挂载UEFI分区: diskutil mount disk1s1

打开Finder,注意后面有个. : open .

查看apfs分区表: diskutil apfs list

  1. 如何开启原生SSD Trim功能

sudo trimforce enable

  1. 不使用任何程序教你提取显示器的EDID,解决笔记本显示器内屏黑屏/花屏的问题

ioreg -lw0 | grep -i “IODisplayEDID” | sed -e ‘s/.*<//‘ -e ‘s/>//‘

接着输入下面的两条命令:

ioreg -l | grep “DisplayVendorID”

​ “DisplayVendorID” = 3502

ioreg -l | grep “DisplayProductID”

​ “DisplayProductID” = 5600

其中<>里面的内容就是显示器的EDID信息,将提取出来的EDID信息粘贴到clover的 config.plist 中,顺便将 VendorID 和 ProductID 填入相应的位置,然后保存重启你的电脑。

  1. 笔记本开启插电源出提示音:

开启:

defaults write com.apple.PowerChime ChimeOnAllHardware -bool true; open /System/Library/CoreServices/PowerChime.app &

关闭:

defaults write com.apple.PowerChime ChimeOnAllHardware -bool false; killall PowerChime

  1. 如何去掉apfs.efi最新版本的日志调试显示

cd ~/Desktop # 进入当前用户桌面

cp /usr/standalone/i386/apfs.efi . # 复制最新版本的apfs.efi到当前目录

perl -i -pe ‘s|\x00\x74\x07\xb8\xff\xff|\x00\x90\x90\xb8\xff\xff|sg’ ./apfs.efi # 去掉日志调试回显

  1. 一键查询硬件信息:

sh -c “$(curl -fsSL https://raw.githubusercontent.com/daliansky/dell7000/master/Tools/archey)"

  1. 一建hdmi

sh -c “$(curl -fsSL https://raw.githubusercontent.com/xzhih/one-key-hidpi/master/hidpi.sh)"

  1. 在命令行中输入以下命令安装Homebrew:
    /usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  2. Appstore登录问题

    defaults delete com.apple.appstore.commerce Storefront

    defaults write com.apple.appstore.commerce Storefront -string “$(defaults read com.apple.appstore.commerce Storefront | sed s/,8/,13/)”