Mac

brew upgrade cask that mark as auto-upgrade

Posted on

brew cask outdated --greedy --verbose | grep -v '(latest)' | awk '{print $1}' | xargs brew cask reinstall

Reference

https://stackoverflow.com/questions/31968664/upgrade-all-the-casks-installed-via-homebrew-cask

Disable auto-switching desktops on mac

Posted on Updated on

In VScode Arduino add-on, the Arduino logo will pop-up when you compiling or uploading your code. When you turn on the full-screen mode or you VScode, your desktop will switch to another mac finder desktop page automatically. It is very annoying when you reading your code during that moment. To disable the auto-switching behavior of the mac, you need the following command.

defaults write com.apple.dock workspaces-auto-swoosh -bool NO
killall Dock

Reference:

https://discussions.apple.com/thread/4995042

解決macOS Mojava字體變得模糊的問題

Posted on Updated on

For English Version, Please click here

蘋果在macOS mojava中禁用了在顯示字體時所使用到的次像素反鋸齒的功能。這令到在mojava中的字體變得模糊並難以看清楚。在一些程式如Firefox、VS Code 中特別嚴重。

如果你是使用Retina顯示器,你應該看不到這個問題。這時因為Retina顯示器是用很高像素去渲染圖像和字體。可是如果你是使用非Retina顯示器的話,那顯示器上的字體便人會變得十分難看。

解決方法

在終端機中輸入以下的2行指令,便可解決字體變得模糊的問題。你需要重新登入帳號/重新啓動電腦才能使指令生效。

defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO
defaults -currentHost write -globalDomain AppleFontSmoothing -int 3

 

參考:

https://github.com/Microsoft/vscode/issues/51132
https://www.howtogeek.com/358596/how-to-fix-blurry-fonts-on-macos-mojave-with-subpixel-antialiasing/

Fix blurry/thin font on macOS Mojava

Posted on Updated on

查看中文版本 , 請按此進入

Apple disables the subpixel font anti-aliasing on macOS mojava. It makes most of the font become blurry and thin. Most of the programs such as VS Code, firefox have this program.

If you are using a retina display, it is not a problem that all of the graphics are rendered in high DPI mode. But in a non-retina display, everything looks horrible.

Solution

These commands can enable the font smoothing feature on your macOS. You need to re-login your account or restart your computer to take effect.

defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO
defaults -currentHost write -globalDomain AppleFontSmoothing -int 3

 

Reference:

https://github.com/Microsoft/vscode/issues/51132
https://www.howtogeek.com/358596/how-to-fix-blurry-fonts-on-macos-mojave-with-subpixel-antialiasing/

Change sleep setting on your mac

Posted on

I change the sleep setting from sleep to hibernate by using the following configuration

use “man pmset” to learn how to use the pmset command

standbydelay         3600    #default=10800, 3 hour
hibernatemode        25      #default=3

Reference:

https://computers.tutsplus.com/tutorials/how-to-hibernate-a-mac–cms-23235

Disable boot-up when you open the lid in your Mac

Posted on Updated on

 The new macbook pro (2016-2018 model) have a “great” feature that boot up automatically when you open the lid. But this feature is quite annoying in some of the situation. For example, when you open the lid for checking the battery level or just cleaning the keyboard, your macbook boots up. Then, you need to wait the boot up process complete and shutdown your macbook, quite time consuming .
 After you disable the auto boot-up feautre, you need to press the power button (Touch ID sensor) or press the keyboard key serval times to boot up the system.

Instruction

Open the terminal app, type the following command.

#Disable boot up when you open the lid
sudo nvram AutoBoot=%00
#Enable boot up when you open the lid
sudo nvram AutoBoot=%03
#Enable boot sound
sudo nvram BootAudio=%01
#Disable boot sound
sudo nvram BootAudio=%00

Reference

http://www.idownloadblog.com/2016/10/31/how-to-stop-the-new-macbook-pro-from-automatically-turning-on-when-the-lid-is-open/

[Mac] Using Package manager

Posted on Updated on

Macports

  1. Install the Xcode and X code command line tools
    You can download it from mac appstore

  2. Install the macports through package installer
    It may take awhile (~10 min)

Download the install from here according your macOS version
https://www.macports.org/install.php

Troubleshoot

Fix Xcodebuild is unusable

#Error: Xcode appears to be installed but xcodebuild is unusable
sudo xcode-select -switch /Applications/Xcode.app

You can find the available ports (package list) in here:
https://www.macports.org/ports.php

Homebrew

  1. Install homebrew
    run this command
#from https://brew.sh/
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

You can find the available formula (package list) in here:
https://formulae.brew.sh/formula/