Skip to content

Dev workflow

Tsuyoshi Tokuda edited this page May 14, 2023 · 4 revisions

Git clone + jump to a directory

I use the ghq to manage remote repositories.
The ghq provides a way to download and manage remote repositories on the local machine.

For example, if you run the following command:

$ ghq get https://github.com/x-motemen/ghq

A ghq directory will be downloaded to the ~/ghq/github.com/x-motemen/ghq.

The repositories downloaded by the ghq get are placed in the ~/Sources directory because I have configured the following in my .gitconfig file.

[ghq]
	root = ~/Sources

How to uninstall unnecessary Homebrew packages

To check for any unnecessary packages installed through Homebrew, you can use the brew leaves command to list all the installed packages that are not dependencies of any other packages.

❯ brew leaves
cairo
docker-compose
exa
...
zoxide

To list packages from others, you can use the brew uses command with the --installed option.

❯ brew uses --installed [email protected]
cairo

To uninstall a package, you can use the brew uninstall command followed by the package name.

❯ brew uninstall cairo
❯ brew uninstall [email protected]

Please note that uninstalling packages may cause issues with other packages that depend on them. It is recommended to only uninstall packages that you are certain are not needed.

Install an older version of the Homebrew formula

The procedure for installing past versions will be given, using Hack Nerd Font (Hack) as an example.
Since this font is a formula in the homebrew/cask-fonts repository, change directory to the repository root.

❯ cd "$(brew --repo homebrew/cask-fonts)"

Downgrade Homebrew to the commit which upgrades the formula to the specific version that we want.

❯ git log Casks/font-hack-nerd-font.rb
commit 1003d5f1b78b68ae8d192ac50cfef5848a33ad51
Author: Fini <[email protected]>
Date:   Sat May 13 23:03:32 2023 +0200

    [ci] Update Nerd Font casks to v3.0.1 (#7575)

    Co-authored-by: Finii <[email protected]>

commit 516018032c03e9ae1f8c3e57604c5592fe2a6104
Author: Fini <[email protected]>
Date:   Mon May 1 13:18:15 2023 +0200

    [ci] Update Nerd Font casks to v3.0.0 (#7525)

commit 206152fc5f8eb04c8d8b19efc043dc045a991eb4
Author: zuisong <[email protected]>
Date:   Wed Jan 25 17:52:52 2023 +0800

    font-hack-nerd-font 2.3.3

    Update font-hack-nerd-font from 2.3.2 to 2.3.3

    Closes #7039.

    Signed-off-by: Patrick Linnane <[email protected]>
    Signed-off-by: BrewTestBot <[email protected]>

❯ git checkout -b font-hack-nerd-font-2.3.3 206152fc5f8eb04c8d8b19efc043dc045a991eb4

Uninstall, in case we already have a version installed.

❯ brew uninstall --cask font-hack-nerd-font

Install and force Homebrew not to update itself and the list of formula.

❯ HOMEBREW_NO_AUTO_UPDATE=1 brew install --cask font-hack-nerd-font
==> Downloading https://github.com/ryanoasis/nerd-fonts/releases/download/v2.3.3/Hack.zip
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/27574418/7b9eadbd-91c4-4495-afbf-28b0d9c0e3cb?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230514%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=202
######################################################################################################################################################################################################################################################### 100.0%
==> Installing Cask font-hack-nerd-font
==> Moving Font 'Hack Regular Nerd Font Complete.ttf' to '/Users/tokuda109/Library/Fonts/Hack Regular Nerd Font Complete.ttf'
==> Moving Font 'Hack Bold Italic Nerd Font Complete.ttf' to '/Users/tokuda109/Library/Fonts/Hack Bold Italic Nerd Font Complete.ttf'
==> Moving Font 'Hack Bold Nerd Font Complete Mono.ttf' to '/Users/tokuda109/Library/Fonts/Hack Bold Nerd Font Complete Mono.ttf'
==> Moving Font 'Hack Bold Nerd Font Complete.ttf' to '/Users/tokuda109/Library/Fonts/Hack Bold Nerd Font Complete.ttf'
==> Moving Font 'Hack Italic Nerd Font Complete Mono.ttf' to '/Users/tokuda109/Library/Fonts/Hack Italic Nerd Font Complete Mono.ttf'
==> Moving Font 'Hack Italic Nerd Font Complete.ttf' to '/Users/tokuda109/Library/Fonts/Hack Italic Nerd Font Complete.ttf'
==> Moving Font 'Hack Regular Nerd Font Complete Mono.ttf' to '/Users/tokuda109/Library/Fonts/Hack Regular Nerd Font Complete Mono.ttf'
==> Moving Font 'Hack Bold Italic Nerd Font Complete Mono.ttf' to '/Users/tokuda109/Library/Fonts/Hack Bold Italic Nerd Font Complete Mono.ttf'
🍺  font-hack-nerd-font was successfully installed!