第一篇文章可以知道我是在 WSL(Windows Subsystem for Linux)上寫文章的,體驗了一個多月下來,以 Windows 進行練習,除了 路徑問題(檔名含中文等 unicode 字元) 終端機環境整合(powershell wsl zsh) 檔案系統(CRLF 刪檔案速度) 畫面分享(AppleTV 不給連?) 外也沒那麼不堪,而憑藉著從小電腦課的主場優勢有人學校是滿滿的 Mac 嗎,加上微軟這幾年擁抱開源下,似乎不需要有寫程式就是要拿蘋果的焦慮感。

話雖如此,為了實際驗證都市傳說,我找回了自從開始打遊戲就被扔在角落,2015 年初版 Mac book,運氣不錯,剛好在支援清單內,現在就讓我們一起感受,標榜軟硬整合、使用者體驗的蘋果電腦能帶來的威力吧。


安裝環境是每位工程師避之唯恐不及的苦差事,如果你還沒有體驗到可能是你有個工具人好朋友,在程式語言中重複的事情可以抽出成為函數,現在把視野放遠,要快速安裝好環境你可以寫 shell script,就靠自己寫成文章,送給未來的你一點小確幸吧。


Terminal 終端機

相較於視窗程式採用GUI環境操作,透過滑鼠點擊元素,終端機採用CLI介面操作,接受指令的速度有著天壤之別,想想在LOL裡,你會用滑鼠點擊技能列再施放嗎

行有餘力可以學學 Vi/Vim 讓你不明覺厲

iTerm2

相較於系統原生的 Terminal,有更多的設定可以調整。

https://iterm2.com/

zsh

相較於原生的 Bash shell,有著更豐富的設定。

oh-my-zsh

zsh 聲名大噪的套件,擁有華麗的畫面與各種快速鍵設定、錯誤提示等。

zsh.png

Homebrew

https://brew.sh/index_zh-tw.html

Homebrew

套件管理系統

RVM

RVM

Ruby 的版本管理系統,讓你針對專案快速切換不同版本。

GPG

簽章驗證,好像 Mac 預設沒安裝。

Ruby

透過 RVM 安裝 Ruby

現在時間8月15日,安裝的是 3.1.2

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
$ rvm install 3.1.2
## No binary rubies available for: osx/12.5/x86_64/ruby-3.1.2.
## Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
## Checking requirements for osx.
## ...
## Install of ruby-3.1.2 - #complete
## Ruby was built without documentation, to build it run: rvm docs generate-ri
## Making gemset ruby-3.1.2 pristine - please wait
## Making gemset ruby-3.1.2@global pristine - please wait

$ ruby -v
## ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]

rubygems

https://rubygems.org/

下載 Ruby 相關的套件,如同 npm <-> Node.js、pip <-> Python

Rails

透過 gem 下載 Rails

現在時間8月15日,安裝的是 6.1.2

1
2
3
4
5
6
7
8
$ gem install rails -v 6.1.2
## ...
## Done installing documentation for rack, concurrent-ruby, sprockets, zeitwerk, tzinfo, i18n, activesupport, nokogiri, crass, loofah, rails-html-sanitizer, rails-dom-testing, rack-test, erubi, builder, actionview, actionpack, sprockets-rails, thor, method_source, railties, mini_mime, marcel, activemodel, activerecord, globalid, activejob, activestorage, actiontext, mail, actionmailer, actionmailbox, websocket-extensions, websocket-driver, nio4r, actioncable, rails after 46 seconds
## 37 gems installed
## Time: 0h:01m:15s

$ rails -v
## Rails 6.1.6

but, 要能成功啟動 Rails Server 還需要幾件事

Node.js

現在時間8月15日,安裝的是 v16

https://nodejs.org/en/download/

yarn

https://ithelp.ithome.com.tw/articles/10191745

1
$ sudo npm install yarn --location=global

試試 new 一個 Rails 專案吧


以下沒辦法無腦裝,我們之後再寫一篇好好講解 XD

git

1
$ git --version

git-version

VS Code

continue