Skip to content

Instantly share code, notes, and snippets.

@RA80533
Last active November 3, 2022 23:48
Show Gist options
  • Save RA80533/92f7861a14138a790a888023c0a3c969 to your computer and use it in GitHub Desktop.
Save RA80533/92f7861a14138a790a888023c0a3c969 to your computer and use it in GitHub Desktop.
# .zprofile
PATH="${HOME}/.local/bin:${PATH}"
function () {
local BREW_PREFIX="${HOME}/.local/opt/homebrew"
alias brew="${BREW_PREFIX}/bin/brew"
function () {
export HOMEBREW_PREFIX="${BREW_PREFIX}"
export HOMEBREW_CELLAR="${BREW_PREFIX}/Cellar"
export HOMEBREW_REPOSITORY="${BREW_PREFIX}"
}
}
if [ ! "${GPG_TTY+set}" ]
then
function () {
local TMP_TTY="$(tty 2> /dev/null)"
if [ ! -z "${TMP_TTY}" ]
# ^^^^
# Non-empty string
then
export GPG_TTY="${TMP_TTY}"
return
fi
echo >& 2 "${0}: failed to set GPG_TTY"
}
fi
# .zshrc
if [ ! -z "${HOMEBREW_PREFIX}" ]
# ^^^^
# Non-empty string
then
FPATH="${HOMEBREW_PREFIX}/share/zsh/site-functions:${FPATH}"
autoload -Uz compinit
compinit
fi

Homebrew

Installation

Installing brew

root@macbook-pro ~ % mkdir '.local'
root@macbook-pro ~ % cd .local/
root@macbook-pro .local % 
root@macbook-pro .local % mkdir bin
root@macbook-pro .local % mkdir lib
root@macbook-pro .local % mkdir opt
root@macbook-pro .local % mkdir share
root@macbook-pro .local % cd opt/
root@macbook-pro opt % 
root@macbook-pro opt % mkdir homebrew

Run the following line:

curl -L 'https://github.com/Homebrew/brew/tarball/master' | tar xz --strip 1 -C homebrew/

Setting up the environment

% alias brew="${HOME}/.local/opt/homebrew/bin/brew"

Verify the previous line ran as expected:

% which brew
brew: aliased to /Users/root/.local/opt/homebrew/bin/brew
% export PATH="${HOME}/.local/bin:${PATH}"

Verify the previous line ran as expected:

% echo "PATH: ${PATH}"
PATH: /Users/root/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
@RA80533
Copy link
Author

RA80533 commented Sep 13, 2022

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