oh-my-zsh: Insecure completion-dependent directories detected

In case you encounter this error on installing oh-my-zsh, do the chmod commands below.

?  ~ source ~/.zshrc                                                                                                  
[oh-my-zsh] Insecure completion-dependent directories detected:
drwxrwxr-x  16 Anton.Perez  admin  512 May  4 10:42 /usr/local/share

[oh-my-zsh] For safety, we will not load completions from these directories until
[oh-my-zsh] you fix their permissions and ownership and restart zsh.
[oh-my-zsh] See the above list for directories with group or other writability.

[oh-my-zsh] To fix your permissions you can do so by disabling
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
[oh-my-zsh] owner of these directories is either root or your current user.
[oh-my-zsh] The following command may help:
[oh-my-zsh]     compaudit | xargs chmod g-w,o-w

[oh-my-zsh] If the above didn't help or you want to skip the verification of
[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.

zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]? ncompinit: initialization aborted

Run these:

?  ~ chmod 755 /usr/local/share/zsh
?  ~ chmod 755 /usr/local/share/zsh/site-functions

GitHub: The unauthenticated git protocol on port 9418 is no longer supported

GitHub recently improved security, so you may get the error below like I did when I tried to install oh-my-zsh on a new Mac.

Anton.Perez@amp ~ % sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Cloning Oh My Zsh...
fatal: remote error: 
  The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
Error: git clone of oh-my-zsh repo failed

You can test if it’s because you need to add an SSH key by running:

ssh -vvv git@github.com

You’ll get an error like so if so:

debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
git@github.com: Permission denied (publickey).

If so, just generate a new key and add it to your GitHub account (see this. That’s it!

Homebrew: “Permission denied @ rb_file_s_symlink…”

In case you encounter this error below when doing brew update:

==> Homebrew has enabled anonymous aggregate formula and cask analytics.
Read the analytics documentation (and how to opt-out) here:
No analytics have been recorded yet (nor will be during this `brew` run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
Updated 1 tap (homebrew/core).
No changes to formulae.
Error: Failed to link all completions, docs and manpages:
  Permission denied @ rb_file_s_symlink - (../../../Homebrew/completions/zsh/_brew, /usr/local/share/zsh/site-functions/_brew)
?  tfm git:(master) ? sudo chown -R $(whoami) $(brew --prefix)/*

Copy-and-paste the following in your terminal:

sudo chown -R $(whoami) $(brew --prefix)/*

GCloud: List roles a service account is a member of

GCloud command to list roles a service account is a member of:

gcloud projects get-iam-policy $GCP_PROJECT \
--flatten="bindings[].members" \
--format='table(bindings.role)' \

Reference: https://jamiekt.wordpress.com/2019/06/13/use-gcloud-to-list-all-project-roles-that-a-service-account-is-a-member-of/

iTerm2: Add Keystroke to move between words

On a Mac, I use iTerm2 as my default terminal due to the added features, such as auto-copy and the ability to split multiple terminals. One nuance was not having the ability to move between words (like in vim); however, I found the below how-to on Stack Overflow — where else? 🙂

  1. Go to Preferences, Profile, Keys.
  2. Set your left ? key to act as an escape character.
  3. Locate the current shortcut for ? ? or create a new one, with the following settings:
    • Keyboard Shortcut: ??
    • Action: Send Escape Sequence
    • Esc+: b
  4. repeat for the ?? keyboard shortcut with the following settings:
    • Keyboard Shortcut: ??
    • Action: Send Escape Sequence
    • Esc+: f

From this point, you can use Option + [left/right arrow keys]. Yass, productivity skill level increase! Later.