|
| 1 | +#!/bin/bash |
| 2 | +# bash_profile vs bashrc: |
| 3 | +# - bash_profile: sourced for LOGIN shells (SSH, Terminal.app on macOS, console login) |
| 4 | +# - bashrc: sourced for INTERACTIVE NON-LOGIN shells (running `bash` from existing shell) |
| 5 | +# This file sources bashrc so all settings work regardless of shell type |
| 6 | + |
| 7 | +{{ if .is_macos -}} |
| 8 | +# ------------------------------------------------------------------------------ |
| 9 | +# Locale Configuration |
| 10 | +# ------------------------------------------------------------------------------ |
| 11 | +# My macOS is configured with AppleLocale=en_ES (English language, Spain region) |
| 12 | +# because I live in Spain but prefer English. Problem is, there's no en_ES Unix |
| 13 | +# locale on macOS. The terminal tries to derive locale settings from this, fails, |
| 14 | +# and ends up setting LC_CTYPE=UTF-8, which is invalid (locales need the full |
| 15 | +# format like en_IE.UTF-8, not just UTF-8). This causes bash to complain: |
| 16 | +# |
| 17 | +# bash: warning: setlocale: LC_COLLATE: cannot change locale (): No such file |
| 18 | +# |
| 19 | +# The fix: explicitly set a valid locale. I use en_IE.UTF-8 (English/Ireland) |
| 20 | +# because it gives me: |
| 21 | +# - British English spelling (colour, metre, etc.) |
| 22 | +# - Metric system |
| 23 | +# - Euro currency symbol |
| 24 | +# - 24-hour time format |
| 25 | +# - dd/MM/yyyy date format |
| 26 | +# |
| 27 | +# Useful commands: |
| 28 | +# defaults read -g AppleLocale # Check macOS locale setting |
| 29 | +# locale -a | grep en_ # List available English locales |
| 30 | +# locale # Verify current settings |
| 31 | +# ------------------------------------------------------------------------------ |
| 32 | +export LANG=en_IE.UTF-8 |
| 33 | +export LC_ALL=en_IE.UTF-8 |
| 34 | + |
| 35 | +{{ end -}} |
| 36 | +# shellcheck source=/dev/null |
| 37 | +[[ -s $HOME/.bashrc ]] && source "$HOME/.bashrc" |
| 38 | + |
0 commit comments