Last active
April 17, 2025 10:44
-
-
Save antonvasin/e1d0efa567f66d52e7c42841ce797009 to your computer and use it in GitHub Desktop.
Updates zig, zls and shell-completions for macOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| echo "Updating zig..." | |
| latest=$(curl -sS https://ziglang.org/download/index.json | jq -r .master.version) | |
| if command -v zig >/dev/null 2>&1 && [ "$latest" = "$(zig version)" ]; then | |
| echo "Already have latest version of zig" | |
| else | |
| url=$(curl https://ziglang.org/download/index.json | jq -r '.master."aarch64-macos".tarball') | |
| filename=$(basename $url) | |
| curl -J -O $url | |
| tar xzf $filename | |
| sudo ln -fs "$(pwd)/$(basename $filename .tar.xz)/zig" /usr/local/bin/zig | |
| fi | |
| echo "Updating zls..." | |
| cd zls && git pull --rebase | |
| if zig build -Doptimize=ReleaseSafe; then | |
| cd .. | |
| sudo ln -fs "$(pwd)/zls/zig-out/zls" /usr/local/bin/zls | |
| mkdir -p ~/Library/Caches/zls | |
| # TODO: maybe not needed if we mkdir ourselves | |
| sudo chown -R $USER ~/Library/Caches/zls | |
| else | |
| cd .. | |
| echo "Compilation failed" | |
| fi | |
| echo "Updating shell completions..." | |
| (cd ./shell-completions/ && git pull --rebase) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment