使用者工具

網站工具


apple:mac_os_x

Mac OS X

Screenshot 畫面截圖

  • 全螢幕:⌘ + ⇧ + 3 (command + shift + 3)
  • 自行選擇區域:⌘ + ⇧ + 4 (command + shift + 4)
  • 特定視窗:⌘ + ⇧ + 4 → Space (Command + Shift + 4 放開後 空白鍵)

加上 control 鍵則直接複製到剪貼簿。

製作 macOS 10.13 High Sierra 安裝 ISO 檔

sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/[USBDisk]

製作 macOS 10.11 安裝 ISO 檔

hdiutil attach /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o /tmp/ElCapitan.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/ElCapitan.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
cp -rp /Volumes/install_app/Packages /Volumes/OS\ X\ Base\ System/System/Installation/
cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/BaseSystem.chunklist
cp -rp /Volumes/install_app/BaseSystem.dmg /Volumes/OS\ X\ Base\ System/BaseSystem.dmg
hdiutil detach /Volumes/install_app
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil convert /tmp/ElCapitan.cdr.dmg -format UDTO -o /tmp/ElCapitan.iso
mv /tmp/ElCapitan.iso.cdr ~/Desktop/ElCapitan.iso

Mavericks(10.9) 掛載 NTFS 硬碟

Ref: http://coolestguidesontheplanet.com/how-to-write-to-a-ntfs-drive-from-os-x-mavericks/

1. Remove fuse4x if exist

  brew remove fuse4x

2. Install ntfs-3g

  brew install ntfs-3g

3. Exchange mount_ntfs

  sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.orig
  sudo ln -s /usr/local/Cellar/ntfs-3g/2014.2.15/sbin/mount_ntfs /sbin/mount_ntfs

4. Install osxfuse

  brew install osxfuse

5. Install osxfuse kernel instructions

  sudo /bin/cp -RfX /usr/local/Cellar/osxfuse/2.6.4/Library/Filesystems/osxfusefs.fs /Library/Filesystems
  sudo chmod +s /Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs

Ignore the warning dialog.

Mountain Lion 掛載 NTFS 硬碟

Ref: http://prateekvjoshi.com/2013/04/21/ntfs-write-support-on-os-x-mountain-lion/

  1. Uninstall other 3rd-party NTFS software, like Paragon, Tuxera or NTFS-3G.
  2. Edit /etc/fstab (you can do this with “sudo vi /etc/fstab”)
    1. Add the following line:
      LABEL=”VOLUME_NAME_WITHOUT_QUOTES” none ntfs rw,auto,nobrowse
    2. Quit your editor
  3. Unmount and re-mount the disk
  4. Open Terminal and type “open /Volumes/THE_NAME_OF_YOUR_VOLUME” (without the quotes)
  5. The Finder pops up automatically and you can see your disk listed there

Lion 掛載 NTFS 硬碟

Ref: NTFS-3G in Mac OS X Lion (10.7) with read-write support

下載 MacFUSE 64-bit 以及 NTFS-3G stable 並安裝。

「15秒問題」可以透過 Workaround for NTFS-3G and Lion's CoreFoundation bug 解決,不過需要有 gcc (XCode) 自行編譯。

但是在系統更新後,可能需要重新覆蓋。

另外文章內有提到可以拿舊版 Snow Leopard 裡面的 NTFS 來用,但是可能會導致硬碟分割區整個爛掉,不建議使用。

讓 .bashrc 生效

在 ~/.bash_profile 內加入

if [ -f ~/.bashrc ]; then
  source ~/.bashrc
fi

讓終端機 ls 有顏色

Ref: http://howardxu-blog.logdown.com/posts/18879-mac-ls

  1. 用文字編輯器打開 ~/.bash_profile
  2. 加入 export CLICOLOR='true' (讓 ls 顯示顏色)
  3. 加入 export LSCOLORS=“gxfxcxdxcxegedabagacad” (設定不同種檔案的顏色,可以自定)

剪貼簿

將檔案的內容複製到剪貼簿中

$ pbcopy < file

將剪貼簿的內容印到螢幕上

$ pbpaste

睡眠方式設定

在 MacOS 中將螢幕上蓋闔起來後統稱為睡眠,睡眠有三種模式:

  • 0 : suspend to RAM (Windows 中的待命)
  • 3 : suspend to RAM + Disk (安全睡眠)
  • 5 : suspend to Disk (Windows 中的休眠)

若要把所有狀態改成 suspend to Disk:

sudo pmset -a hibernatemode 5
  • -b 代表只套用到電池設定
  • -c 代表只套用到外接電源
  • -a 代表套用到所有電源設定

防止出現.DS_Store 檔案

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE

恢復原本設定:

defaults delete com.apple.desktopservices DSDontWriteNetworkStores

批次刪除已存在的.DS_Store

sudo find . -name ".DS_Store" -depth -exec rm {} \;

用 MacBook 分享無線網路給 iPhone

http://funiphone.pixnet.net/blog/post/27893659

「系統偏好設定」→「共享」→「共享連線來源」選擇上網的有線或無線網卡,「對使用以下傳輸埠的電腦」為要連上來上網的有線或無線網卡。

「啟用加密保護(使用WEP)」。

鍵盤快速鍵

  • fn + F8:顯示所有虛擬桌面
  • fn + F9:列出所有視窗(與F3同)
  • fn + F11:顯示桌面
  • fn + F12:顯示桌面小工具(與F4同)
  • control + 1 ~ 4:切換虛擬桌面(左上、右上、左下、右下)
  • command + control + option + 8:將螢幕改成負片
  • control + Eject:關機選項
  • control + shift + Eject:關閉螢幕
  • control + option + esc:強制結束程式

irssi

切換 channel:esc → 數字鍵

捲動頁面:fn + shift + 上下鍵

滑鼠手勢

兩指上下左右:捲動頁面

三指上下:頁首、頁尾

三指左右:上一頁、下一頁

四指向下:列出所有視窗

四指向上:顯示桌面

四指左右:選擇視窗(與command + tab相同)

安裝

hostname

修改主機名稱

scutil --set HostName [new hostname]

man scutil 也可查詢其他修改,如 ComputerName(GUI 用)及 LocalHostName (Bonjour用)。

系統字體

軟體

基礎

Homebrew

Install

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Install Software

brew install wget

Update

brew update
brew update --force

brew outdated
brew upgrade

MacPorts

MacPorts: http://www.macports.org/

說明文件:http://guide.macports.org/

手動安裝 MacPorts,也可直接透過包好的映像檔安裝。

# cd /tmp && mkdir ports && cd ports
# svn checkout http://svn.macports.org/repository/macports/trunk
# cd trunk/base
# ./configure && make install && make distclean

增加環境參數,在家目錄中修改 .profile 檔,加入

export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH

更新套件庫

# port -v selfupdate

搜尋套件

# port search [name]

安裝套件

# port install [name]

瀏覽器

影音播放

開發

Cocoa

Java

升級、重灌

10.10 Yosemite

apple/mac_os_x.txt · 上一次變更: 2017/09/29 17:01 由 sars