Skip to content

Instantly share code, notes, and snippets.

@acdesouza
Last active April 25, 2025 14:53
Show Gist options
  • Save acdesouza/0077353b58e5a81f7dccad14d097fe4d to your computer and use it in GitHub Desktop.
Save acdesouza/0077353b58e5a81f7dccad14d097fe4d to your computer and use it in GitHub Desktop.
Script to update Alacritty building it from source
# #!/bin/bash
# Update Alacritty
############################################################
# Help #
############################################################
help() {
# Display Help
echo "This script will update Alacritty building it from source code."
echo
echo "Syntax: scriptTemplate [-t]"
echo "options:"
echo "t Git tag to be used. It will git checkout to it. Latest tag is the default"
echo
}
updateAlacritty() {
# Start making sure rust is updated
# https://rust-lang.github.io/rustup/basics.html
rustup override set stable
rustup update
# Update Alacritty repo and build the app
# https://github.com/alacritty/alacritty/blob/master/INSTALL.md#macos
cd <REPLACE_WITH_YOUR_PATH>/alacritty # <<=============================== REPLACE WITH YOUR PATH
git checkout master
git pull --rebase
############################################################
# Update the project tag if the option was used. #
############################################################
echo "############################################################"
SELECTED_TAG=$1
RELEASE_TAG="$(git for-each-ref --sort=-creatordate --format '%(refname:short)' refs/tags | head -n 1)"
echo "Latest tag ($RELEASE_TAG)"
echo "Selected tag ($SELECTED_TAG)"
if [ -n "${SELECTED_TAG}" ]; then
RELEASE_TAG=$1
fi
echo "Building Alacritty version ($RELEASE_TAG)..."
git checkout $RELEASE_TAG
make app
cp -r target/release/osx/Alacritty.app /Applications/
git checkout master
echo "############################################################"
}
############################################################
############################################################
# Main program #
############################################################
############################################################
# Get the options
while getopts ":ht:" option; do
case $option in
h) # display Help
help
exit;;
t) # update the Alacritty using selected tag
updateAlacritty $OPTARG
exit;;
\?) # Invalid option
echo "Error: Invalid option"
exit;;
esac
done
updateAlacritty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment