FreeBSD | You must upgrade the ports-mgmt/pkg port first.

Sample Error:

pkg(8) must be version 1.6.0 or greater, but you have 1.5.4. You must upgrade the ports-mgmt/pkg port first.

Fix:

cd /usr/ports/ports-mgmt/pkg
make deinstall reinstall

macOS How To: Use Touch ID to authenticate as sudo in Terminal

TL;DR: 

To authenticate as sudo in Terminal, paste the following line into /etc/pam.d/sudo

auth       sufficient     pam_tid.so
Step-by-step Instructions:

Firstly you’ll need to open /etc/pam.d/sudo in a file editor within Terminal. You can do this by running the following command:

sudo vi /etc/pam.d/sudo

Then, press the key on your keyboard, this will allow you to insert text.

Then, paste the following line into the file – you’ll need to use the keyboard for navigating around the file, but you can use the right click context menu to paste (or CMD or Edit > Paste).

I made a new line below the first line, but it can go anywhere as long as it’s on a new line:

auth       sufficient     pam_tid.so

Then, press the escape key on your keyboard. Then type :wq! and press enter. This will save the changes to the file.

Lastly, quit Terminal by pressing CMD + Q. Then relaunch Terminal and run a command as sudo (e.g; sudo -i to change to root in Terminal) to test.

macOS How To: Bypass Gatekeeper for “App cannot be opened. You should move it to trash.”

To bypass Gatekeeper and open an app when “App cannot be opened. You should move it to trash.” comes up, simply open Terminal (Applications > Utilities > Terminal) and run the following command:

sudo xattr -r -d com.apple.quarantine /Applications/name of app.app

You’ll need to replace name of app.app with the name of the application you’re trying to open.

You can find this out by going to the Applications folder and finding the first few letters of the app name, you can then auto-complete the name in Terminal by pressing the tab key (above Capslock) in Terminal after typing the first few letters of the name of your app.

Example: Type the following, and then press tab:

sudo xattr -r -d com.apple.quarantine /Applications/Microsoft Wor

macOS will autocomplete it to:

sudo xattr -r -d com.apple.quarantine /Applications/Microsoft Word.app