Skip to content

Commit e537f34

Browse files
committed
chore: add macos install script
1 parent d81e3f6 commit e537f34

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

installs/macos.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
find_bin_path() {
2+
for dir in /usr/local/bin /usr/bin /bin; do
3+
if echo "$PATH" | grep -qE "(^|:)$dir(:|$)"; then
4+
echo $dir
5+
return
6+
fi
7+
done
8+
}
9+
10+
set -e
11+
12+
echo "Installing kill-tree..."
13+
14+
bin_path=$(find_bin_path)
15+
if [ -z "$bin_path" ]; then
16+
echo "No bin path found in PATH"
17+
exit 1
18+
fi
19+
20+
temp_dir=$(mktemp -d)
21+
cd $temp_dir
22+
23+
curl -L -s https://api.github.com/repos/oneofthezombies/kill-tree/releases/latest | \
24+
grep "kill-tree-macos-x86_64" | \
25+
grep "browser_download_url" | \
26+
cut -d '"' -f 4 | \
27+
xargs curl -L -s -o kill-tree && \
28+
chmod +x kill-tree && \
29+
mv kill-tree $bin_path/kill-tree && \
30+
rm -rf $temp_dir
31+
32+
echo "kill-tree install location: $bin_path/kill-tree"
33+
34+
echo "try printing version..."
35+
kill-tree --version
36+
37+
echo "kill-tree installed successfully."
38+
exit 0
39+
40+

0 commit comments

Comments
 (0)