How to make a global shortcut to open Finder in MacOS

Maybe you want to have a shortcut to open the Finder app, just like “Win + E” in Windows to open the Explorer. However, you will find there is no easy setup for this in the System Preference. Here I will show you how to create a global shortcut to open your home directory .

Knowledge we need:

  1. Automator
  2. AppleScript (Just copy and paste)
  3. Shortcuts in System Preference


Open Automator. You can use ⌘+Space and input “Automator”

Use ⌘+Space to open automator

Click Service to create a new service

Create a new service

Select the “Service receives” to be “no input”

Service recieves: no input

Use the right window and find the “Run AppleScripts”. Drag it to the main window:

Select “Run AppleScripts”

Copy and paste the following code to AppleScripts window:

on run {input, parameters}
	tell application "Finder"
		open home
	end tell
end run

It should look like this:

AppleScript to open your home directory

You are all set. Save it and quit the Automator. The only thing you need to do is to go to “System Preference” -> “Keyboard” -> “Shortcuts” -> “Services”. Assign a shortcut to your service. I would recommend “Ctrl – F”.

You can also change the AppleSript to open any folder you want.

Thanks for reading.

Quick fix to “No file detected” problem in youcompleteme plugin in Vim

After you install the youcompleteme plugin in Vim, you possibly meet this problem:

No file detected ….

You may google it and find this quick solution: put an extra line in your .vimrc:

let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/cpp/ycm/’

However, this does not solve the problem as of Sept, 2017.

This is because the author changed the structure of the YCM folder. Add this to your .vimrc, and it solves the problem now
let g:ycm_global_ycm_extra_conf = '~/.vim/plugged/youcompleteme/third_party/ycmd/cpp/ycm/’

The best way is that read the very long manual to understand it totally.

Do not assign your applications to *All Desktops* in MacOS

I have be tortured by a bug of Mission Control for a long time. Searching around the whole internet, I found little information about it. I also metioned this in my previous blog. Now I finally find the right solution: Do not assign applications to All Desktops.

Using Mission Control to switch applications is cool and easy, but I have been suffering this weird phenomenon: sometimes the selected application immediately jumps back to the background. See this gif for a demo of the bug:


This is very annoying and frustuating. It turns out to be a bug of Mission Control and Dock. Here is the solution:

  1. Right click the Terminal icon on the Dock.
  2. Click Options.
  3. Assigns it to None rather than All Desktops.

Hope it helps!

How to install TeX in your Mac using BasicTex?

Here I would like to share my idea on how to install TeX in your Mac using BasicTex.

Typically the resource from the internet would recommend you to install MacTex with full packages, which is huge (more than 8G) and takes several hours to download and install it. This is ridiculous since most of packages are never going to be used in your whole life. It does not makes sense to install such huge software considering the size of your SSD hard dish is limited.

There is another way of installing TeX in your mac. However, it is not recommanded by many people inasmuch as they are afraid of any potential problems during the installation. That’s not true! TeX should be configurable and flexible according to our requirements. So I encourage you to use the BasicTex, which has several advantages:

  1. Small. The size of the package is only 110 M, compared to 2.8G of MacTex. (20161006 Version). Installing it takes only 10 minutes.
  2. It could be installed by Homebrew, which could help update it easily. However, regular update is not necessary. Security bugs are rare in TeX.
  3. The number of packages coming with it is small, which means we can get rid of bunches of packages unrelated to our writing.
  4. We can choose our own editor rather than TexShop and TexMaker.

OK. If you stay, we can begin our short journey of TeX installatin. Brace yourself for its easiness.


I would like to assume you know nothing about Terminal. Just use Spotlight and input Terminal, you will get something like this (it might be black but does not matter). That is the place where we are going to install TeX.

A typical terminal

Install Homebrew

HomeBrew is not as powerful as apt-get but still offers a lot of missing package management features in Mac. Input the following code in the terminal and enter:

/usr/bin/ruby -e "$(curl -fsSL"

And just wait for it finishing. Permission may be asked.

Install Homebrew cask

After you finish the installation of home-brew, you might notice that no any new app icon appear in your launcher center. Don’t worry, that is normal. Homebrew installs all command-line software for you not Apps. However with the help of cask, we can also install Apps. To install cask, just input:

brew install cask

Install BasicTeX

Finally, we are ready to install BasicTeX, just input:

brew cask install basictex

And that’s it! You just wait for the finish of the installation and now you are able to use TeX in Mac


But wait! You may notice that you don’t have any new Apps. It turns out that you just owns the latex or pdflatex commands in your terminal. But believe me, the foundation of TeX system has been built in your Mac. One of the only two things you need is a Editor for your tex file. Any editor for text file could be used as the editor of tex in principle but I would recommand Texnicle


TeX Live Manager (tlmgr)

The other thing you need to know is the TeX Live Manager (tlmgr). This is a command-line software which helps you install the packages you need. The GUI version is not reomamnded since it is ugly and slow. The first thing you need to do is to update its database

sudo tlmgr update --self

It might take a while. Then you use tlmgr to install any packages you want. For example, if you need multicol package, all you need to do is input

sudo tlmgr install multicol

Bingo! You are all set!

How to fix a mission control bug in macOS Sierra temporarily

You may meet a mission control bug which is quite annoying: you swipe up with three finger to use mission control and select one app, let say Safari. However, safari pops up quickly and moves to the behind another app, such as mail. You may notice the menu is changed to Finder not mail nor Safari.

It should be a bug in the mission control. Many users complained in the but no solution is provided. Restarting mission control turns out to be able to fix it!

Open your terminal and enter killall Dock

Hope it helps.

PS. It does not fix the problem. Only temporarily.

Render the Solar System

Our gorgeous home (rendered, not real earth, :-))

Blender is a really good free 3D modeling software. I always believe that as researchers we should learn some image manipulation and 3D modeling tools to better present our interesting discoveries to this curious world and promote more kids to pursue the beauty of the nature. Science should be sexy!

Here I would like to share you some images rendered by Blender. I used some free textures from NASA and other websites and watched the Blender Guru on Youtube hosted by Andrew Price (I encourage you to watch if you also want your own solar system!) An awesome earth is created here, and it inspired me to render my own “earth” (shown above) and all other planets in our lonely and splendid solar system.

P.S. If you like my pictures, you can download here. Use them as you like. Please acknowledge this blog and NASA who owns the copyright of the textures.