diff --git a/install-mac.sh b/install-mac.sh index fbcd4c1..98bc10c 100755 --- a/install-mac.sh +++ b/install-mac.sh @@ -3,20 +3,14 @@ # Path to your dotfiles. export DOTFILES=$HOME/.dotfiles -# Paths to openssl to build pecl extensions (swoole) -export PATH="/opt/homebrew/opt/openssl@3/bin:$PATH" -export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib" -export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include" -export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig" - echo "Setting up your Mac..." # Check for Homebrew and install if we don't have it if test ! $(which brew); then /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> $HOME/.zprofile - eval "$(/opt/homebrew/bin/brew shellenv)" + echo 'eval "$(${HOMEBREW_PREFIX}/bin/brew shellenv)"' >> $HOME/.zprofile + eval "$(${HOMEBREW_PREFIX}/bin/brew shellenv)" fi # Update Homebrew recipes @@ -28,7 +22,7 @@ brew tap homebrew/bundle # Rosetta is required for microsoft teams softwareupdate --install-rosetta -brew bundle --file $DOTFILES/macos/Brewfile +brew bundle --file ${DOTFILES}/macos/Brewfile # Fix for https://github.com/Homebrew/homebrew-core/issues/74447 # gnupg is not really needed but marked as a dependency for pass @@ -37,18 +31,24 @@ brew unlink gnupg # Install pynvim for nvim pip3 install --user pynvim +# Paths to openssl to build pecl extensions (swoole) +export PATH="${HOMEBREW_PREFIX}/opt/openssl@3/bin:$PATH" +export LDFLAGS="-L${HOMEBREW_PREFIX}/opt/openssl@3/lib" +export CPPFLAGS="-I${HOMEBREW_PREFIX}/opt/openssl@3/include" +export PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/openssl@3/lib/pkgconfig" + # Install PHP extensions with PECL -pecl install imagick redis +yes | pecl install imagick redis # Symlink pcre2, so pecl can find it when installing / building (needed for swoole) sudo mkdir -p /usr/local/include -sudo ln -s /opt/homebrew/include/pcre2.h /usr/local/include/ +sudo ln -s ${HOMEBREW_PREFIX}/include/pcre2.h /usr/local/include/ # Install swoole with all features yes | pecl install swoole # Install global Composer packages -/opt/homebrew/bin/composer global require laravel/installer laravel/valet tightenco/takeout +${HOMEBREW_PREFIX}/bin/composer global require laravel/installer laravel/valet tightenco/takeout # Install Laravel Valet $HOME/.config/composer/vendor/bin/valet install @@ -59,13 +59,13 @@ mkdir -p $HOME/git/konaktiva mkdir -p $HOME/git/private # Symlink the Mackup config file to the home directory -ln -s $DOTFILES/macos/.mackup.cfg $HOME/.mackup.cfg +ln -s ${DOTFILES}/macos/.mackup.cfg $HOME/.mackup.cfg # Activate asimov to automatically exclude node_modules from TM backup sudo brew services start asimov # Set macOS preferences - we will run this last because this will reload the shell -source $DOTFILES/macos/.macos +source ${DOTFILES}/macos/.macos # Call the general install script to setup zsh etc. source install.sh diff --git a/install.sh b/install.sh index b9b3d60..566624d 100755 --- a/install.sh +++ b/install.sh @@ -6,9 +6,9 @@ export DOTFILES=$HOME/.dotfiles echo "Setting up your system..." echo "Your dotfiles path: $DOTFILES" -if [ ! -d ~/.znap/znap ]; then +if [ ! -d $HOME/.znap/znap ]; then echo "Installing znap..." - sh -c "$(git clone --depth 1 -- https://github.com/marlonrichert/zsh-snap.git ~/.znap/znap)" + sh -c "$(git clone --depth 1 -- https://github.com/marlonrichert/zsh-snap.git $HOME/.znap/znap)" fi # Removes .zshrc from $HOME (if it exists) and symlinks the .zshrc file from the .dotfiles diff --git a/macos/bin/pkg-update b/macos/bin/pkg-update index 80d894a..c7365c1 100755 --- a/macos/bin/pkg-update +++ b/macos/bin/pkg-update @@ -8,10 +8,10 @@ brew unlink gnupg echo "\n > Upgrading pecl packages...\n" # Paths to openssl to build pecl extensions (swoole) -export PATH="/opt/homebrew/opt/openssl@3/bin:$PATH" -export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib" -export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include" -export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig" +export PATH="${HOMEBREW_PREFIX}/opt/openssl@3/bin:$PATH" +export LDFLAGS="-L${HOMEBREW_PREFIX}/opt/openssl@3/lib" +export CPPFLAGS="-I${HOMEBREW_PREFIX}/opt/openssl@3/include" +export PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/opt/openssl@3/lib/pkgconfig" pecl upgrade diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index aa41774..d0c3ad2 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -4,9 +4,9 @@ if [[ $OSTYPE == 'darwin'* ]]; then alias clip="pbcopy" alias copyssh="pbcopy < $HOME/.ssh/id_ed25519.pub" - alias ls="/opt/homebrew/opt/coreutils/libexec/gnubin/ls" + alias ls="${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnubin/ls" alias reloaddns="dscacheutil -flushcache && sudo killall -HUP mDNSResponder" - alias composer="php -d memory_limit=-1 /opt/homebrew/bin/composer" + alias composer="php -d memory_limit=-1 ${HOMEBREW_PREFIX}/bin/composer" alias sup="$DOTFILES/macos/bin/pkg-update" fi