macOS12 Oct 2020 • Leave Comments
- Package Installation
- General Setup
- Shell Setup
- Docker Desktop
macOS (Mac OS X or OS X) is a proprietary OS derived from Berkeley Software Distribution (BSD), and therefore is a Unix-like system. The main difference between macOS and other Unix-like distributions is that macOS is designed with desktop for personal PC.
# Screenshot shift + command + 3/4/5 # Lock Screen ctrl + command + q
- App Store.
- Jamf Self Service.
- touchpad tap with 1 click
- ssh; load-ssh-agent
Set "bashrc" and "bash_profile" only after the following:
brew install coreutils type gdate ; type date brew install xz brew install bash type -a bash cat >>/etc/shells <<EOL > /opt/homebrew/bin/bash > EOL chsh -s /opt/homebrew/bin/bash openssl version -a brew install email@example.com /opt/homebrew/Cellar/openssl\@1.1/1.1.1o/bin/openssl version -a PATH="/firstname.lastname@example.org/bin:$PATH" brew install emacs weechat tmux nmap utm gnupg brew install libpq PATH="/opt/homebrew/opt/libpq/bin:$PATH" brew install btop mkdir -p ~/.config/btop PATH="/usr/local/go/bin:$HOME/go/bin:$PATH"
- Mac with Apple silicon
- For compatibility, run softwareupdate –install-rosetta.
Everything of Homebrew is located under
$(brew --prefix) (e.g., /opt/homebrew).
Get help info.
~ $ brew commands ~ $ brew help install ~ $ brew doctor
brew supports installing both CLI utilities and GUI formulae (i.e. package).
~ $ brew install <formulae>
~ $ brew install [--cask] <formulae>
--caskis optinal and brew cask is no longer a supported command.
~ $ brew update ~ $ brew outdated ~ $ brew upgrade
A tap is a repository from where brew retrieves packages. By default, brew assumes a Github repository.
Official tap list.
~ $ brew tap homebrew/cask homebrew/core
Say we have a tap named as user/repo, the repository is
https://github.com/<user>/homebrew-<repo> (homebrew prefix). Take homebrew/core for example, the Github URL is https://github.com/homebrew/homebrew-core. The tap is cloned to local disk under directory $(brew –repository)/Library/Taps.
We can add/remove 3rd-party taps on demand.
# assume Github repo ~ $ brew tap <user/repo> # -or- ~ $ brew tap <user/homebrew-repo> # Other repo with specific URL ~ $ brew tap <user/repo> <URL> # remove ~ $ brew untap user/repo
Once added, we can install formulae as in Homebrew.
However, brew tries to install a formulae from official taps first. In case of duplicate formulae names among taps, We can install a formulae from a specific 3rd-party tap.
~ $ brew install user/repo/formulae
This section shows how to create a 3rd-party tap.
Step 1. Create an empty Github repo as the personal tap, namely homebrew-wrk2. The repo name must follow pattern
homebrew-<foo> (homebrew prefix). We will put our formulaes into directory "Formula".
Now, let's add the personal tap to Homebrew.
~ $ brew tap outsinre/wrk2 ~ $ brew tap homebrew/cask homebrew/core outsinre/wrk2 ~ $ cd $(brew --repository outsinre/wrk2) ~ $ git status ~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ git status On branch master Your branch is up to date with 'origin/master'. nothing to commit, working tree clean ~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ tree . ├── Formula └── README.md 1 directory, 1 files ~ $ brew tap --eval-all outsinre/wrk2
Step 2. Prepare code release.
~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ git branch -a ~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ git checkout wrk2-a64-support ~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ git diff head~1 ~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ git checkout master ~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ git merge wrk2-a64-support ~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ git tag -l ~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ git tag -a 1.0.0 -m "release 1.0.0" HEAD ~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ git tag -l ~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ git show -s 1.0.0 ~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ git push origin head ~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ git push origin 1.0.0
Go to Github and create release 1.0.0.
Step 3. Create formulae.
~ $ brew create --tap outsinre/wrk2 https://github.com/outsinre/wrk2/archive/refs/tags/1.0.0.tar.gz
Command above puts the newly formulae into our local personal tap outsinre/wrk2. If we don't offer the
--tap option, the formulae would, by default, be placed into the official tap (i.e. homebrew/core).
Step 4. Audit the new formulae's adherence to Homebrew house style.
~ $ brew tap --eval-all outsinre/wrk2 ~ $ brew audit --strict --online outsinre/wrk2/wrk2 # more strict ~ $ brew audit --new outsinre/wrk2/wrk2 outsinre/wrk2/wrk2: * 2: col 9: Description shouldn't start with an article. * 7: col 3: `license` (line 7) should be put before `head` (line 6) * 24: col 12: Ambiguous splat operator. Parenthesize the method arguments if it's surely a splat operator, or add a whitespace to the right of the `*` if it should be a multiplication. Error: 3 problems in 1 formula detected
Update formulae according to audit results.
~ $ cd $(brew --repository outsinre/wrk2) ~ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ nano -w wrk2.rb
Step 5. Sync local tap with Github.
~ $ cd $(brew --repository outsinre/wrk2) ~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ git status ~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ git add . ~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ git commit -m "add formulae wrk2" ~ $ /opt/homebrew/Library/Taps/outsinre/homebrew-wrk2$ git push origin head
Step 6. Install the new formulae.
~ $ brew install outsinre/wrk2/wrk2
If a new release is out. We should firstly backup and remove
$(brew --repository outsinre/wrk2)/Formula/wrk2.rb and then repeat steps 2 ~ 6 above. Mostly, we only need to update the sha256 and url part.
However, we can also install the from the latest source code if head is defined the formulae.
~ $ brew install --HEAD outsinre/wrk2/wrk2
- Creating and running your own Homebrew tap
- Step by step guide to create Homebrew tap
UTM is an open source VMM supporting iOS and OSX. What is more, it supports Apple ARM64!
- After installation, remove and re-add the USB (DVD) drive, otherwise the boot menu break from time to time.
- Follow tutorial UTM Ubuntu 20.04.
UTM uses davfs2 to share files with host OS. Here is setup on guest OS:
# clipboard sharing, mouse integration ~ $ apt install spice-vdagent # file shareing ~ $ apt install spice-webdavd davfs2 # group ~ $ sudo usermod -a -G davfs2 kong ~ $ sudo reboot # /etc/fstab http://127.0.0.1:9843 /media/webdav davfs _netdev,noauto,noexec,user,uid=kong,gid=kong 0 0 ~ $ mkdir -p /media/webdav ~ $ mount /media/webdav ~ $ ls -al ~/.davfs2/ # auto password # ~/.davfs2/secrets /media/webdav kong kong ~ $ umount /media/wevdav ~ $ mount /media/wevdav
If just use Web browser (e.g. VM has X), then no need to install davfs2.