MacOS入門

winterdawn發表於2016-04-18

1. 桌面操作

1.1 finder

系統預設的finder太不好用了,使用XtraFinder代替
https://www.trankynam.com/xtrafinder/
在10.11中,還需要進行額外的配置
https://www.trankynam.com/xtrafinder/sip.html

1.2 截圖

截圖也不好用,十分詭異的快捷鍵

  • Cmd+Shift+3: 全屏截圖

  • Cmd+Shift+4: 選擇截圖

  • Cmd+Shift+4, Space: 視窗截圖

  • 截圖同時按住Ctrl, 儲存到剪貼簿中

推薦使用QQ的截圖鍵:Ctrl+Cmd+A.
如果同時安裝了微信,此快捷鍵會被微信覆蓋,然而微信的截圖並不好用。所以把微信的快捷鍵改成隨便什麼東西(貌似不能置空,置空是預設快捷鍵,還是會覆蓋)

1.3 複製貼上剪下

系統沒有單一的剪下命令
使用Cmd+c, Cmd+v複製貼上
使用Cmd+c, Cmd+Opt+v剪下貼上

使用XtraFinder解決此問題:Cmd+x:剪下

1.4 快速切換中英文輸入

系統原生輸入法是不支援的,只支援Cmd+Space切換中英文
請安裝第三方輸入法

1.5 視窗控制

按住Opt同時點全屏可以垂直最大化
按住Shift+Opt同時點全屏可以最大化
F11顯示桌面

2. shell相關

2.1 HomeBrew

http://brew.sh/
使用以下命令安裝

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2.2 bash 4

brew install bash

This formula is keg-only, which means it was not symlinked into /usr/local.

OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are defaulting this GNU Readline installation to keg-only.

Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add to your build variables:

LDFLAGS:  -L/usr/local/opt/readline/lib
CPPFLAGS: -I/usr/local/opt/readline/include

In order to use this build of bash as your login shell, it must be added to /etc/shells.

切換bash版本

chsh -s /usr/local/bin/bash

安裝bash補全

brew install bash-completion

Add the following lines to your ~/.bash_profile:

if [ -f $(brew --prefix)/etc/bash_completion ]; then
  . $(brew --prefix)/etc/bash_completion
fi

Homebrew's own bash completion script has been installed to
/usr/local/etc/bash_completion.d

Bash completion has been installed to:
/usr/local/etc/bash_completion.d

terminal

使用iTerm
開啟新標籤頁時保留路徑
Profiles -> General -> Working Directory: Reuse previous session's directory
clipboard.png

日曆

https://www.mowglii.com/itsycal/

改變快捷鍵

使用系統配置的方法並不完美,推薦使用這個軟體
https://pqrs.org/osx/karabiner/index.html.en
裡邊有選項可以替換快捷鍵。
還可以自定義qq/wechat的傳送訊息快捷鍵
樣例private.xml

<?xml version="1.0"?>
<root>
    <appdef>
        <appname>WECHAT</appname>
        <euqal>com.tencent.xinWeChat</euqal>
    </appdef>
    <appdef>
        <appname>QQ</appname>
        <equal>com.tencent.qq</equal>
    </appdef>

    <item>
        <name>Use Ctrl+Return to send message in IM</name>
        <identifier>private.im.ctrl_enter</identifier>
        <only>WECHAT, QQ</only>
        <autogen>
            __KeyToKey__
            KeyCode::RETURN, ModifierFlag::CONTROL_L,
            KeyCode::RETURN, ModifierFlag::COMMAND_L
        </autogen>
    </item>
</root>

一些shell命令差異

# macos的ln,如果目標是一個目錄(目錄的link)的話,則在目錄中建立軟鏈
# 使用-h代替
ln -s
ln -sh

3. 軟體相關

3.1 安裝cherrytree

http://bt27uk.blogspot.jp/2014/07/getting-cherry-tree-installed-on-mac.html

  • http://www.giuspen.com/cherrytree/#downl下載原始碼

  • 安裝pygtk:
    brew install pygtk pygtksourceview

  • 安裝dbus
    brew install dbus
    brew install dbus-glib
    /usr/local/bin/pip install dbus-python

  • 啟動dbus
    launchctl load /usr/local/opt/d-bus/org.freedesktop.dbus-session.plist

  • 強制使用brew版本的python
    edit cherrytree
    #!/usr/bin/env python2 ->
    #!/usr/local/bin/python2.7

To have launchd start d-bus at login:
  ln -sfv /usr/local/opt/d-bus/*.plist ~/Library/LaunchAgents
Then to load d-bus now:
  launchctl load ~/Library/LaunchAgents/org.freedesktop.dbus-session.plist

3.2 安裝mysql

brew install mysql

啟動mysql

mysql.server start

其他說明

We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

To connect run:
    mysql -uroot

To have launchd start mysql at login:
  ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
Then to load mysql now:
  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Or, if you don't want/need launchctl, you can just run:
  mysql.server start

3.3 java環境

JDK
oracle官網安裝
IDEA
jetbrain官網下載安裝
maven

brew install maven

相關文章