顯示具有 Mac 標籤的文章。 顯示所有文章
顯示具有 Mac 標籤的文章。 顯示所有文章

2020年9月9日 星期三

[Tool] using gnu-sed on Mac OSX

  • 問題: 
    • Mac OS 上的 sed 為 BSD sed, 與 Linux上的 gnu sed 差異非常大, 像是不支援 -i, -e 等, 相當煩人
  • 解決方法:
    • 方法一: 用 brew 安裝 gnu-sed, 並將 PATH 環境變數優先指到 gnu-sed$ brew install gnu-sed
    • $ vim ~/.bash_profile
        PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
      $ source ~/.bash_profile
    • 方法二: build from source, 並將 PATH 環境變數優先指到 gnu-sed

2020年8月16日 星期日

[Mac] 電池使用情況 (Power Health Information)

  • 可透過 About This Mac -> System Report -> Power -> Power Health Information 來看硬體使用情形
    • Condition 簡短描述電池狀態
    • Cycle Count 則表示循環次數, 評估完整放電/充電次數, 通常超過循環次數上限, 則電池效率便會下降, 建議更換電池, 新的 Macbook Pro 一般上限為 1000, 但不同機型上線不太一樣, 可參考 Reference 連結.
  • Reference:
    • 判斷 Mac 筆記型電腦電池的循環使用次數

2018年10月3日 星期三

[Mac] 硬體重設與診斷


2018年9月29日 星期六

[Python] setup Python environment in Mac OSX


  • Environment setup
    • install Python (via MacPorts)
    • sudo port install python
    • version selection (e.g version: 3.6 or 2.7)
      • check installed version by
      • port installed | grep python
      sudo port select --set python python36 (or python27)
      
      Success message: "Selecting 'python36' for 'python' succeeded. 'python36' is now active."
      
    • install pip & select version (python package manager)
    • sudo port install py36-pip (or py27-pip)
      port select --set pip pip36
      
  • Reference

2018年1月6日 星期六

[Word] Mac 版 Microsoft Word 中文直書


  • Problem: Mac上的 Microsoft Word, 想排版成中文直書, 但直書只看得到連字也順時針轉 90度的選項
  • Solution:
    1. 關閉 Word
    2. 設定 Microsoft Language Register到 Traditional Chinese
      1. 應用程式 -> Microsoft Word 20xx -> Additional Tools -> Microsoft Language Register
    3. 重開 Word, Layout中看到 Layout中的直書選項即可
    4. Reference: [教學]如何在Office 2004 for Mac Word 中輸入直式中文

2017年11月29日 星期三

2017年8月27日 星期日

[Mac] Code sign for gdb


  • 在 Mac上以 MacPort 安裝 gdb 後, 會顯示
  •  gdb has the following notes:
        You will need to codesign /opt/local/bin/ggdb
        
        See
        https://sourceware.org/gdb/wiki/BuildingOnDarwin#Giving_gdb_permission_to_control_other_processes
        for more information. 
  • 請按照網頁所列方法為 gdb 做 code sign. 否則在 gdb run的時候會顯示以下 error message:
  • Unable to find Mach task port for process-id 72241: (os/kern) failure (0x5).
     (please check gdb is codesigned - see taskgated(8))
    

2017年2月25日 星期六

[Mac] 清除 Mail 相關檔案

Mac OSX Sierra 在 System Information.app (系統資訊) 中加入了儲存空間管理 (Command + U)的功能, 但滿常看到, "郵件" 裡面有許多正在使用的儲存空間, 卻無法移除(如下圖)


可以到 ~/Library/Mail/V4/ 底下, 將一些數字ID的資料夾清除即可.

2013年6月5日 星期三

[Vim] Mac中 Vim 設定


  • 預設路徑
    • binary: /usr/bin
      support file: /usr/share/vim/vim73
      rc: ~/.vim/vimrc (若沒有, 請自己建)
  • 細節

    • 單一檔案的 plugin 應放在 ~/.vim/plugin下, e.g. a.vim
    • 其他 plugin一句底下的資料夾放置(例如: ctrlp)
      • ~/.vim/autoload/ctrlp/
      • ~/.vim/autoload/ctrlp/ctrlp.vim
      • ~/.vim/doc/ctrlp.txt
      • ~/.vim/plugin/ctrlp.vim
    • plugins/colorschemes/scripts 放在 ~/.vim下, not /usr/share/vim/vim73
  • 推薦 plugins:
    • a.vim: 在 header與 source file間切換
      • :A =>切換
      • :AT =>切換至新開的 tag page
      • :AS => split? 垂直分割
      • :AV => horizontal 分割
      • 不知為啥, 我覺得 :AS與 :AV 沒作用
  • Ref:

2013年2月2日 星期六

[Mac] Audio Format Utility

在 Mac上若想要查看或編輯音樂檔案, 可使用音樂相關工具程式 (prefix af: Audio Format)
  • afinfo: Audio Format Information, 查看音樂檔案相關內容, 包含 sampling rate, data rate, estimation duration
  • afconvert: Audio Format Convert, 音樂轉檔功能, 常用選項(option), -b: 指定輸出 bit rate, -f: format
  • afplay: 利用 command line來播放音樂

2012年11月28日 星期三

[Mac] 執行視窗全螢幕快捷鍵


Mac OSX 提供了應用程式全螢幕操作的功能, 只要是窗右上角如上圖所示即可.

方法:

  • 以滑鼠點選該圖示
  • Ctrl+command+F

2012年11月26日 星期一

[Mac] build wxWidgets2.8.12 from source code in MacOSX


  • 執行以下程式
    • mkdir build
    • cd build
    • arch_flags="-arch -i386"
    • ../configure CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags" --enable-unicode --enable-debug --disable-shared --with-osx_cocoa --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
    • make
    • cd ..
    • cd build-carbon-debug/samples;make;cd ../..
    • cd build-carbon-debug/demos;make;cd ../..
  • 發生以下錯誤
    • ../include/wx/mac/carbon/private.h:1459: error: 'Cursor' does not name a type
  • 解決辦法
    • Apple Developer Center 下載 XCode 4.3.3
    • 右鍵選擇 Package Content
    • 將 /Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSC10.6.sdk 整個資料夾 copy到 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
    • build clean
    • build
  • 參考網站

2012年9月18日 星期二

[XCode] 讓終端機能呼叫 XCode的指令 (Command Line Tools)

在 XCode中安裝 Command Line Tools的方法:
XCode->偏好設定->Downloads->Components->Command Line Tools  Install