-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbash_osx
More file actions
73 lines (61 loc) · 2.45 KB
/
bash_osx
File metadata and controls
73 lines (61 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# -*- bash -*-
# shellcheck shell=bash
# ~/.bash_osx: macOS specific modifications and tweaks
[[ $- == *i* ]] || return 0
[[ "$(uname -s)" == "Darwin" ]] || return 0
################################################################################
# macOS Environment Variables
################################################################################
# Silence notice about `zsh`.
export BASH_SILENCE_DEPRECATION_WARNING=1
# Enable CLI Colors
export CLICOLOR=YES
# Tab ignores
export FIGNORE=${FIGNORE:+${FIGNORE}:}.DS_Store:.Trash
# GPG Pin Entry CLI setup
export PINENTRY_USER_DATA="USE_CURSES=1"
################################################################################
# Tooling
################################################################################
# ------------------------------
# Homebrew
# ------------------------------
# urda.bash supports Homebrew on Apple Silicon only.
if [ -x /opt/homebrew/bin/brew ] && [[ -z ${URDABASH_LOADED_HOMEBREW+x} ]]; then
readonly URDABASH_LOADED_HOMEBREW=1
eval "$(/opt/homebrew/bin/brew shellenv)"
# Hide Homebrew Env Hints
export HOMEBREW_NO_ENV_HINTS=true
# Disable auto-update on install/upgrade; use `update_brew` instead
export HOMEBREW_NO_AUTO_UPDATE=1
update_brew() {
# Run the full Homebrew maintenance sequence.
# Steps: update, upgrade, autoremove, cleanup, doctor.
local bold normal
bold=$(tput bold 2>/dev/null || printf '')
normal=$(tput sgr0 2>/dev/null || printf '')
brew --version &&
echo "${bold} > brew update${normal}" && brew update &&
echo "${bold} > brew upgrade${normal}" && brew upgrade &&
echo "${bold} > brew autoremove${normal}" && brew autoremove &&
echo "${bold} > brew cleanup${normal}" && brew cleanup &&
echo "${bold} > brew doctor${normal}" && brew doctor;
}
# ------------------------------
# Bash completions
# ------------------------------
_brew_prefix="$(brew --prefix 2>/dev/null)"
# Prefer bash-completion v2 (requires bash 4.2+), fall back to v1
if [[ -r "${_brew_prefix}/etc/profile.d/bash_completion.sh" ]]; then
# bash-completion v2
# shellcheck source=/dev/null
source "${_brew_prefix}/etc/profile.d/bash_completion.sh"
elif [[ -r "${_brew_prefix}/etc/bash_completion" ]]; then
# bash-completion v1
# shellcheck source=/dev/null
source "${_brew_prefix}/etc/bash_completion"
fi
unset _brew_prefix
else
[[ -z ${URDABASH_LOADED_HOMEBREW+x} ]] && readonly URDABASH_LOADED_HOMEBREW=0
fi