Hello My Macbook Pro
Overview
Macbook
shortcut
common
大多數 app 通用,但還是要看 app 有沒有支援。
- command + t: new window
- command + w: close window
- command + q: exit process
- command + tab: change current window
screen
- command + shift + 3: full screen
- command + shift + 4: custom mode
- (in custom mode) space: specific window
Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
wget
brew install wget
tree
brew install tree
# 解決中文亂碼
tree -N
# 印出特定層數
tree -L 3
# 輸出 JSON - Prints out an JSON representation of the tree.
tree -J
Visual Studio Code
- command + k, then m: select language mode
editer
- fn/(control + command + space): 顯示表情符號與其他符號
- (注)shift + option + b: 顯示標點符號選單
- (A)shift + option + 英文字母: 輸入相對應的符號
- option + ←/→: 將游標往前/後跳一個詞
- (vs code)option + ↑/↓: 將當前行往上/下移動
- command + option + shift + ↑/↓: 將輸入游標往上/下延伸
建置開發環境
我的原始碼該放在哪裡呢?先來看看家目錄 ~
底下有什麼
家目錄底下看起來沒有適合擺放原始碼的目錄,於是我估狗了一下(搜尋: mac development folder
)
發現似乎在某個版本以前的 macOS ,家目錄下預設就會有 Developer
這個資料夾,不過我的 macbook (macOS Monterey) 的家目錄底下就已經沒有這個資料夾了。
在 Windows OS 底下由於路徑長度的問題,我通常會將原始碼放在 c:\p
(p
代表 project)底下,反而失去了使用者目錄 %USERPROFILE%
的美意。(沒辦法啊 Windows 你就要用路徑長度來搞我)
找到這篇文章,覺得作者建議的還不錯,他在家目錄下開了 dev
這個資料夾,而在 Windows OS 也可以用同樣的邏輯,建立 c:\dev
這個目錄。
https://dev.to/httpjunkie/my-development-directory-structure-3p1g
!!! info
在 linux 底下, /dev
這個目錄代表的是 device 。
建立開發目錄的語法如下:
cd ~
mkdir -p dev/src/{local,github}
cd dev && tree -L 3
tree -L 3
的 output:
.
└── src
├── github
└── local
dotnet 6.0 SDK
m1 = arm64 架構
- macOS x Installers: Arm64
- All: dotnet-install scripts
nvm & node.js & yarn
nvm
https://github.com/nvm-sh/nvm#install--update-script
開啟 terminal
cd ~
mkdir tmp
cd tmp
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
安裝完 nvm 後,執行下面的指令,設定 PATH
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
確認 nvm 是否安裝成功
nvm -v
node.js 12
透過 nvm 安裝 node.js 12
nvm install 12
確認安裝是否成功
node -v
npm -v
安裝 yarn
npm i -g yarn #if yarn isn't installed