Mint icon indicating copy to clipboard operation
Mint copied to clipboard

The mint command can not used in Xcode Run script phase (Mac 11.1 Xcode 12.4 )

Open sunnyweekday opened this issue 3 years ago • 9 comments

Hard ware: MacBook Pro 13 M1 Chip System Version: Mac OS 11.1 Xcode version:12.4

It was build fail when add "mint run swiftlint" script by Xcode Run script phase. The erros msg is:

Script-CC67A95425CFAF5700F12F11.sh: line 3: mint: command not found Command PhaseScriptExecution failed with a nonzero exit code

The demo project is attached.

BigWord.zip

sunnyweekday avatar Feb 18 '21 09:02 sunnyweekday

You could try the absolute path to mint to see if it's a $PATH issue? (run which mint to get the path). I have successfully run mint in build scripts.

danramteke avatar Apr 12 '21 19:04 danramteke

It seems that the cause is that $PATH does not contain /opt/homebrew/bin in Xcode's Run Script.

I added the following code before running mint.

## begin
if [ `uname -m` == 'arm64' ] && [ -d /opt/homebrew/bin/ ]; then
  export PATH=/opt/homebrew/bin:$PATH
fi
## end

mint run swiftlint

Then the "mint: command not found" error no longer occurs.

However, I still get the error 🌱 swiftlint package not found and I can't execute the command with mint.

mironal avatar May 12 '21 08:05 mironal

Did you find a solution to this problem?

mime29 avatar Aug 02 '21 13:08 mime29

I resolved this by use the follow script : export PATH="/opt/homebrew/bin/:$PATH" mint run swiftlint

sunnyweekday avatar Aug 03 '21 09:08 sunnyweekday

Ok, I used your approach, it works. I just made a small change usingxcrun --sdk macosx mint to start Mint

mime29 avatar Aug 03 '21 23:08 mime29

Is there a way to set the PATH system-wide ? I don't understand why we need to update the PATH during the script phase. For example my .zshrc already has the /opt/homebrew/bin/ PATH in the $PATH variable but still... Xcode throws this command not found error.

mime29 avatar Aug 26 '21 01:08 mime29

I had the same problem. After using another install method other than homebrew, everything works great. Lets try:

$ git clone https://github.com/yonaskolb/Mint.git
$ cd Mint
$ make

babacros avatar Nov 03 '21 10:11 babacros

For those who wants to continue using mint from homebrew, you can symlink your brew's mint to /usr/local/bin/mint, make sure there is no existing mint folder in /usr/local/bin.

sudo ln -s /opt/homebrew/bin/mint /usr/local/bin/mint

source: https://stackoverflow.com/a/71674601

yukai18 avatar Nov 11 '22 07:11 yukai18

For those who wants to continue using mint from homebrew, you can symlink your brew's mint to /usr/local/bin/mint, make sure there is no existing mint folder in /usr/local/bin.

sudo ln -s /opt/homebrew/bin/mint /usr/local/bin/mint

source: https://stackoverflow.com/a/71674601

Thanks! It's works!

bystritskiy avatar Mar 31 '23 15:03 bystritskiy