2020-11-19

macos從El Capitain (10.11)升級到Mojave (10.14)

 用El Capitain撐了許久,不升級也不行了,一堆軟體或外掛套件的更新都要求要新一點的OS版本,像homebrew或VSCode一堆套件都要新的作業系統library才有辦法compile & install。

升級時注意事項:

1.先重置nvram跟smc再升級,不然很有可能升級過程中卡住,要是真的卡住就強制關機,再用command+r重裝。

2.重新安裝XCode及command line tools for xcode
https://developer.apple.com/download/more 下載即可,注意mojave支援的XCode最高版本為11.3.1,安裝Xcode前先把舊的Xcode刪掉再複製新的過去,不然會卡很久。

3.homebrew的話,先brew update-reset & brew update,重置repo資料庫,然後brew doctor看看有沒有什麼問題,有些已經不存在formula的可以 brew uninstall --force package-name & rm -rf /usr/local/Caskroom/package-name。

4.java的話,決定先移除oracle java,改安裝openjdk:

brew remove --ignore-dependencies java
brew remove --ignore-dependencies java8

sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencesPanes/JavaControlPanel.prefPane
sudo rm -fr ~/Library/Application\ Support/Java
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.8_xxx.jdk

brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk/openjdk/adoptopenjdk8
brew cask install adoptopenjdk/openjdk/adoptopenjdk11

brew install jenv
echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(jenv init -)"' >> ~/.bash_profile
<重開command window>
jenv add /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
jenv add /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
jenv global 1.8 或 jenv global 11 設定其中一個預設java版本

ref:
https://www.java.com/zh-TW/download/help/mac_uninstall_java.html
https://www.jenv.be/
https://github.com/AdoptOpenJDK/homebrew-openjdk

2020-11-02

Ubuntu 18 + Nvidia 顯卡螢幕撕裂(screen tearing)問題

什麼叫screen tearing:




解決方法:

  1. 安裝nvidia-settings
    sudo apt-get install nvidia-settings

  2. 打開NVIDIA X Server Settings後,選擇左邊X Server Display Configuration/Advanced...,把Force Composition Pipeline或Force Full Composition Pipeline個別其中一個打勾試試

  3. 記得按Save to X Configuration File儲存設定到 /etc/X11/xorg.conf

  4. 選擇左邊nvidia-settings Configuration,按右邊Save Current Configuration儲存設定到 ~/.nvidia-settings-rc

如果是像在瀏覽器chrome上看影片的話,瀏覽器的硬體加速選項可能也要調整:
https://www.lifewire.com/hardware-acceleration-in-chrome-4125122


ref:
https://askubuntu.com/questions/1170247/how-do-i-solve-screen-tearing-on-ubuntu-18-04-with-nvidia