Skip to content

Instantly share code, notes, and snippets.

@vraravam
Last active April 18, 2024 09:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save vraravam/ce8654afd65def117dc17e2b0a30156c to your computer and use it in GitHub Desktop.
Save vraravam/ce8654afd65def117dc17e2b0a30156c to your computer and use it in GitHub Desktop.
This is a companion script for the `~/.zshrc` file
#!/usr/bin/env zsh
# vim:syntax=zsh
# vim:filetype=zsh
# file location: ${HOME}/.zprofile
# Note: This file is loaded BEFORE ${HOME}/.zshrc
# login shell - only env vars and other functions that don't load anything should go in here
# This is a companion script for the `${HOME}/.zshrc` file
if [[ -z "$LANG" ]]; then
export LANG='en_US.UTF-8'
export LANGUAGE=en_US.UTF-8
fi
export LC_COLLATE=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
export LC_MESSAGES=en_US.UTF-8
export LC_MONETARY=en_US.UTF-8
export LC_NUMERIC=en_US.UTF-8
export LC_TIME=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LESSCHARSET=utf-8
export PROJECTS_BASE_DIR=${HOME}/dev
export PERSONAL_CONFIGS_DIR=${HOME}/personal/dev
export PERSONAL_PROFILES_DIR=${HOME}/personal/${USERNAME}/profiles
export PERSONAL_BIN_DIR=${HOME}/.bin
# Do not move this to .zshenv - since that messes up the PATH (homebrew randomly doesn't come ahead of system path)
# Note:
# 1. Added '/usr/local/bin' to the PATH since keybase, devbox, sentinelOne - all install to this hardcoded location
# BUGFIX for keybase installation on m1 macs: https://github.com/keybase/client/issues/15176 #
# 2. Load curl from homebrew in case its present (fix for as-yet-undisclosed CVE vulnerability)
export PATH="${PATH+:$PATH}/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:${PERSONAL_BIN_DIR}:${PERSONAL_BIN_DIR}/git:${PERSONAL_BIN_DIR}/docker:${PERSONAL_BIN_DIR}/linux:${PERSONAL_BIN_DIR}/macos:${PROJECTS_BASE_DIR}/oss/git_scripts:"
# TODO: Need to verify and fix (doesn't work in a fresh install of macos)
# eliminates duplicates in *paths
# typeset -gU cdpath fpath path
@vraravam
Copy link
Author

Moved the setting of the PATH from .zshenv to this file, since keeping it there meant that the homebrew path was inconsistently appearing before/after the system path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment