Mac 終端命令備忘

  1. 查看端口號占用情況,及殺死進程
sudo lsof -i :9000
COMMAND   PID    USER   FD   TYPE    DEVICE        SIZE/OFF   NODE     NAME
java      716      a   313u   IPv6  0x1111111111111   0t0      TCP     *:cslistener (LISTEN)

// 然后根據(jù)PID殺進程:
sudo kill -9 716
  1. 重啟 Finder (macOS High Sierra 中叫 '訪達')
KillAll Finder
  1. 顯示 / 隱藏 Mac 所有隱藏文件
defaults write com.apple.finder AppleShowAllFiles -bool true  // 顯示
defaults write com.apple.finder AppleShowAllFiles -bool false // 隱藏

// 記得后面要重啟 Finder 才能看到效果
KillAll Finder
  1. 單個文件或文件夾顯示 / 隱藏:
chflags nohidden // 顯示
chflags hidden   // 隱藏

// 例如隱藏桌面上的 Kext.zip 文件
chflags hidden /User/你的用戶名/Desktop/Kext.zip
KillAll Finder
  1. 關(guān)閉 / 打開Lion自帶英文輸入法元音長按輸入
defaults write -g ApplePressAndHoldEnabled -bool false // 關(guān)閉
defaults write -g ApplePressAndHoldEnabled -bool true  // 打開
  1. 合并 debug 和 release framework,得到 debug 和 release 模式下都可以運行的 framework
lipo -create debug.framework/xxx release.framework/xxx -output xxx
// A.framework 必須是 framework 文件的完整路徑
// xxx 是 framework 中的靜態(tài)庫文件.
// -output 后面的 xxx 也必須是靜態(tài)庫文件的完整路徑
// 合并完成后,將得到的靜態(tài)庫文件替換原來 debug 或 release framework 中的靜態(tài)庫文件即可
  1. 查看 framework 支持的指令集,比如 armv7, armv7s... 等.
lipo -info xxx  // xxx 是 framework 下的 .a 文件的完整路徑
  1. pod 命令
// pod install 和 pod update 兩個命令直接執(zhí)行會更新 podfile 中指定的所有庫,無論庫是否有更新,有些時候就會非常慢。
// 使用以下命令,只會更新有更新的庫,加快更新時間
pod install --verbose --no-repo-update
pod update --verbose --no-repo-update

// cocoapods 安裝或更新命令   
sudo gem install -n/usr/local/bin cocoapods
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容