Skip to content

Commit 9e35c41

Browse files
committed
Improve reliability of MacOS installation
this should improve how we place MacOS installs in the path for both machine wide and per user installations
1 parent f8c0e0d commit 9e35c41

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

package/scripts/macos/pkg/postinstall

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
#!/bin/sh
22

33
if [[ $EUID -eq 0 ]]; then
4+
5+
## Add to paths.d
6+
echo "$2/bin" > /etc/paths.d/quarto
7+
8+
## Add symlink
49
ln -fs $2/bin/quarto /usr/local/bin/quarto
10+
511
else
612

7-
# write path to zshenv
8-
EXPORTLINE='export PATH="'$2'/bin:$PATH"'
9-
EXPORTFILE=~/.zshenv
13+
# write path to zshrc
14+
touch "${HOME}/.zshrc"
1015

11-
# Add the path to the zshenv if it doesn't already exist
12-
grep -qxF "$EXPORTLINE" "$EXPORTFILE" || echo "$EXPORTLINE" >> "$EXPORTFILE"
16+
BINDIR=$2/bin
17+
EXPORTLINE='# Add quarto to the path
18+
if [[ -d '$BINDIR' ]]; then
19+
export PATH="'$BINDIR':$PATH"
20+
fi'
21+
# Add the path to the zshrc if it doesn't already exist
22+
grep -qxF "$EXPORTLINE" "${HOME}/.zshrc" || echo "$EXPORTLINE" >> "${HOME}/.zshrc"
1323

1424
# try creating symlink, its ok if this doesn't work
1525
ln -fs $2/bin/quarto /usr/local/bin/quarto

0 commit comments

Comments
 (0)