Closed Isuru-Nanayakkara closed 2 years ago
@Isuru-Nanayakkara I think you'll need to bootstrap with the -l or --link
flag to link the built and installed tools into a global accessible place.
As of the most recent release the tools will be symlinked into ~/.mint/bin
(ref: https://github.com/yonaskolb/Mint/releases/tag/0.17.0)
You'll want to add that to the front of your path so that the tools are found first. Something like this in your ~/.zshrc
should do it. export PATH="$HOME/.mint/bin:$PATH"
Once you've setup your path, and run mint bootstrap --link
you should be able to run which swiftlint
and see that it's found in~/.mint/bin
.
Alternatively, you don't have to link the tools or mess with your path. mint
can find the right tool for you. Update your script to ask mint to run the tool for you using:
mint bootstrap #(will be fast if it's already installed)
mint run swiftlint #run the tool installed by mint (no path updates required.
@regnerjr I am running into a similar issue. in my terminal (zsh) mint bootstrap --link works great after exporting the path. i can run which swiftlint and it correctly finds the one in mint bin. However it can't seem to find it in xcode build phase. In the attached file, line 4 works but line 3 doesn't.
Any idea on how to begin debug?
@xuefan-eero Yup there are 2 problems here:
sh
shell probably won't have your export where you updated the path, i.e. export PATH="~/.mint/bin:$PATH"
won't have run so the shell won't be able to find that too. (check in the output (Xcode logs tab) what the PATH variable is set to), you might try to change this to say it's a /bin/bash
or /bin/zsh
script, I'm not sure what setup files will be sourced in those instances (If I remember correctly the ~/.bashrc
and ~/.zshrc
won't be loaded..., but maybe ~/.zshenv will?)rbenv
or nvm
specifically in a build phase and yeah it's a pain)mint run swiftgen
to ensure you're using the right version for your current project, but I'm guessing mint
might also not be in the path when running from an Xcode build phase script.An example for 2 might look like:
# check if directory exists then add it to path
if [ -d ~/.mint/bin ]; then
echo "Adding ~/.mint/bin to PATH"
export PATH=~/.mint/bin:$PATH
else
echo "~/.mint/bin folder is missing"
fi
# check if swiftgen tool can be found.
if [ $(command -v swiftgen) ]; then
swiftgen
else
echo "SwiftGen tool is missing, try running `mint bootstrap --link`"
exit 1
fi
@regnerjr thank you! that makes sense!
Thank you very much, @regnerjr. I just tried the steps you've laid out in the first comment but I also ran into the same issue as @xuefan-eero. SwiftLint is linked globally and even though I had added it to the PATH, it still wasn't being picked up within Xcode. Your script in the second comment worked for me too.
Hi,
I installed SwiftLint via mint. Here is my
Mintfile
.When I ran
mint bootstrap
, I got the following output.Then I added the following as a build script.
But when I build my Xcode project, I still get the warning: SwiftLint not installed message.
I installed mint (v0.16.0) via Homebrew and I'm using Xcode 12.5 on a 2014 iMac running macOS 11.2.3.