Open iewaij opened 1 year ago
This likely specific to the home brew installation process- the pkg itself does have a post build script that creates a symlink in the path so I expect that something about the way home brew runs the pkg causes this. I will take a look soon!
This likely specific to the home brew installation process- the pkg itself does have a post build script that creates a symlink in the path so I expect that something about the way home brew runs the pkg causes this. I will take a look soon!
I did try using pkg directly but it wasn't successful. And I believe the cask code is basically doing the same thing. Maybe I overlooked it.
Hmm - ok that is good to know. Here is what we do post install:
#!/bin/sh
if [[ $EUID -eq 0 ]]; then
ln -fs $2/bin/quarto /usr/local/bin/quarto
else
# write path to zshenv
EXPORTLINE='export PATH="'$2'/bin:$PATH"'
EXPORTFILE=~/.zshenv
# Add the path to the zshenv if it doesn't already exist
grep -qxF "$EXPORTLINE" "$EXPORTFILE" || echo "$EXPORTLINE" >> "$EXPORTFILE"
# try creating symlink, its ok if this doesn't work
ln -fs $2/bin/quarto /usr/local/bin/quarto
fi
exit 0
Do you see anything that we're doing here is that is likely to be incompatible with your system? Its possible this works for many but not all system as it is making path assumptions + terminal assumptions...
A couple of observations:
zshenv
is located in ~
, you should use $ZDOTDIR/.zshenv
(if $ZDOTDIR is unset, then $HOME is used)$PATH
(wrote about it here) so I believe that putting this in .zshenv
won't be optimal. I'd rather append the line to .zshrc
.EDIT: for the moment I use this quick fix in my .zshrc
:
if [ -x /Applications/quarto/bin/quarto ]; then
alias quarto=/Applications/quarto/bin/quarto
fi
Actually I just remembered this is highly coupled with #203. What I just realised is that quarto
(using the official formula provided by quarto dev team) is symlinked under /usr/local/bin
for both ARM and Intel macs. On the latter, that's not a problem; however on the former it is because the prefix
is different! See the install script:
if [[ "${UNAME_MACHINE}" == "arm64" ]]
then
# On ARM macOS, this script installs to /opt/homebrew only
HOMEBREW_PREFIX="/opt/homebrew"
HOMEBREW_REPOSITORY="${HOMEBREW_PREFIX}"
else
# On Intel macOS, this script installs to /usr/local only
HOMEBREW_PREFIX="/usr/local"
HOMEBREW_REPOSITORY="${HOMEBREW_PREFIX}/Homebrew"
fi
HOMEBREW_CACHE="${HOME}/Library/Caches/Homebrew"
After you install brew
, you should run the following: eval "$(homebrew/bin/brew shellenv)"
- which does the following on an M1 mac:
export HOMEBREW_PREFIX="/opt/homebrew";
export HOMEBREW_CELLAR="/opt/homebrew/Cellar";
export HOMEBREW_REPOSITORY="/opt/homebrew";
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}";
export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:";
export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}";
So we should change the post-install script a bit like this:
#!/bin/sh
HOMEBREW_PREFIX="$(brew --prefix)"
# or, more complete
UNAME_MACHINE="$(/usr/bin/uname -m)"
if [[ "${UNAME_MACHINE}" == "arm64" ]]
then
homebrew_prefix="/opt/homebrew"
else
HOMEBREW_PREFIX="/usr/local"
fi
if [[ $EUID -eq 0 ]]; then
ln -fs "${2}/bin/quarto" "${HOMEBREW_PREFIX}/bin/quarto"
else
# write path to zshenv
EXPORTLINE='export PATH="'$2'/bin:$PATH"'
EXPORTFILE=~/.zshenv
# Add the path to the zshenv if it doesn't already exist
grep -qxF "$EXPORTLINE" "$EXPORTFILE" || echo "$EXPORTLINE" >> "$EXPORTFILE"
# try creating symlink, its ok if this doesn't work
ln -fs "${2}/bin/quarto" "${HOMEBREW_PREFIX}/bin/quarto"
fi
exit 0
I am not really aware of the contribution guidelines for quarto, but I'd be glad to help out with this.
@baggiponte Thanks for offer to contribute and sharing your expertise. As for your question about guidelines, have you seen https://github.com/quarto-dev/quarto-cli/blob/main/CONTRIBUTING.md
Perhaps you could add the export line to .bashrc also. Or explain how to do it in the installation instructions.
Hi,
First, thanks so much for making this wonderful tool. I've been an active RMarkdown user, while also working heavily with a VS Code and Python. I'm very excited to see there's a RMarkdown equivalent outside R ecosystem, finally.
I intend to use Quarto with only Python and VS Code on macOS. After using homebrew to install
quarto
, which is the same as installing with thequarto-1.0.37-macos.pkg
file, my shell can't findquarto
in the PATH.After some digging, I discovered that
quarto-1.0.37-macos.pkg
installedquarto
folder in/Applications
. A simple solution would be addingApplications/quarto/bin
into my PATH. However, what I believe is a more elegant solution is following other command line tool installations such as youtube-dl.For whomever facing the similar problem and also uses homebrew on macOS, I moved
/Applications/quarto
to/opt/homebrew/Cellar/quarto
. Then I added the symbolic link ofquarto
to/opt/homebrew/bin/
using the following command (you can also just create a symbolic link without moving):Now my shell can successfully pick
quarto
up.