Skip to content

Commit

Permalink
Separate $PATH and ENV exports
Browse files Browse the repository at this point in the history
- Use if [ -x "$(command -v $BINARY)" ]; then to check if binary is installed and executable
  • Loading branch information
0xmachos committed Oct 12, 2024
1 parent e0590c0 commit fff346c
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,16 @@
INITIAL_DIR="${HOME}/Documents/Projects"


### Homebrew ###
# $PATH & ENV exports MUST be at the top of .zshrc
# We need all of these to be exported first otherwise some commands will fail or behaviour unexpectedly
# See: b79b7968166df0238df8aa61e975b9bcecbabf06

### $PATH Exports ###

eval "$(/opt/homebrew/bin/brew shellenv)"
# Add Homebrew to PATH


### Enviroment Variable Exports ###

if [[ -x "/usr/local/bin/brew" ]]; then
export HOMEBREW_BREWFILE=$HOME/Documents/Projects/dotfiles/.extra/Brewfile
# Set location of Brewfile
fi

if [[ -x "/usr/local/opt/ruby/bin/ruby" ]]; then
if [ -x "$(command -v /usr/local/opt/ruby/bin/ruby)" ]; then
export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:$PATH"
# macOS ships with a version of Ruby at /usr/bin/ruby
# /usr/bin also contains versions of gem and bundler
Expand All @@ -41,12 +37,10 @@ if [[ -x "/usr/local/opt/ruby/bin/ruby" ]]; then
fi

if [[ -x "$(command -v go)" ]]; then
export GOPATH=$HOME/Documents/Projects/go
export PATH=$PATH:$GOPATH/bin
# Go
fi

if [[ -x "/usr/local/bin/python3" && -x "$HOME/Library/Python/3.9/bin/virtualenv" ]]; then
if [ -x "$(command -v "$HOME/Library/Python/3.9/bin/virtualenv")" ]; then
# Should the second check be "$HOME/Library/Python/*/bin/virtualenv" this will need manually
# changed when python moves to version 4.x

Expand All @@ -55,12 +49,21 @@ if [[ -x "/usr/local/bin/python3" && -x "$HOME/Library/Python/3.9/bin/virtualenv
# pip3 show virtualenv
fi

### Enviroment Variable Exports ###

if [ -x "$(command -v /usr/local/bin/brew)" ]; then
export HOMEBREW_BREWFILE=$HOME/Documents/Projects/dotfiles/.extra/Brewfile
# Set location of Brewfile
fi

if [[ -x "$(command -v go)" ]]; then
export GOPATH=$HOME/Documents/Projects/go
fi

if [[ -d "/Applications/Secretive.app" ]]; then
export SSH_AUTH_SOCK=$HOME/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh
fi


export IIOEnableOOP=YES
# Enabled the undocumeted ImageIO sandbox
# Tells ImageIO to parse images our of process in the ImageIOXPCService process instead
Expand Down

0 comments on commit fff346c

Please sign in to comment.