Macosboot

macos 启动过程 launchd开启之后,会依次去完成以下的工作: 根据/System/Library/LaunchDaemons 和/Library/LaunchDaemons路径下的plist文件,加载系统级守护进程; 注册上述守护进程需要的套接字及文件描述符; 根据plist文件中的KeepAlive键值,启动那些需要在系统周期内一直保持的进程; 根据plist文件中的设定,在条件满足时启动进程; 关机时,给所有由launchd开启的进程发送SIGTERM信号。 我们将log信息中的内容与/System/Library/LaunchDaemons路径下的plist进行对照,发现在系统开启之初的bootlog,blued,mDNSResponder等都能再该路径下找到。 LaunchDaemons路径下的plist指定的进程启动是否存在一定的先后顺序呢? 在launchd依次完成的工作中,可以看到它是先注册套接字和文件描述符,然后才去启动进程,因此plist指定的进程的启动先后顺序并不明确。 launchd配置文件总共有五个路径,在系统开启之初,只加载了/System/Library/LaunchDaemons 和/Library/LaunchDaemons路径下的plist文件,另外三个路径下的plist文件是在用户login之后才进行的。 用户的login是由loginwindow进程完成的,而loginwindow的启动又是由/System/Library/LaunchDaemons路径下的com.apple.loginwindow.plist指定的。 用户登录之后,launchd才会去加载/System/Library/LaunchAgents 和/Library/LaunchAgents以及~/Library/LaunchAgents路径下的plist文件,从而根据plist文件的具体设置去启动相应的进程。

2024年10月28日 · Leon

Macos

minikube minikube start --image-mirror-country='cn' --driver=hyperkit --registry-mirror="<https://xxx.mirror.aliyuncs.com>" macos工具集 xldr sourcetree aliyun-cli dash xnip miniconda visualvm maccy obsidian tabby 认证应用 sudo xattr -r -d com.apple.quarantine /Applications/应用名称.app

2024年10月17日 · Leon

Lrzsz

安装lrsz brew install lrzsz iterm2-send-zmodem.sh #!/bin/bash osascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm if [[ $NAME = "iTerm" ]]; then FILE=$(osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")") else FILE=$(osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")") fi if [[ $FILE = "" ]]; then echo Cancelled. # Send ZModem cancel echo -e \\x18\\x18\\x18\\x18\\x18 sleep 1 echo echo \# Cancelled transfer else /usr/local/bin/sz "$FILE" --escape --binary --bufsize 4096 sleep 1 echo echo \# Received "$FILE" fi iterm2-recv-zmodem.sh #!/bin/bash osascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm if [[ $NAME = "iTerm" ]]; then FILE=$(osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")") else FILE=$(osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")") fi if [[ $FILE = "" ]]; then echo Cancelled. # Send ZModem cancel echo -e \\x18\\x18\\x18\\x18\\x18 sleep 1 echo echo \# Cancelled transfer else cd "$FILE" /usr/local/bin/rz --rename --escape --binary --bufsize 4096 sleep 1 echo echo echo \# Sent \-\> $FILE fi iterm2 triggers配置 Regular expression: rz waiting to receive.\*\*B0100 Action: Run Silent Coprocess Parameters: /usr/local/bin/iterm2-send-zmodem.sh Instant: checked Regular expression: \*\*B00000000000000 Action: Run Silent Coprocess Parameters: /usr/local/bin/iterm2-recv-zmodem.sh Instant: checked

2024年10月12日 · Leon