Configuration for my install stack for macOS?

This is my travis.yml currently, company wide for this project:

before_install:
# Download and unpack the stack executable
- mkdir -p ~/.local/bin
- export PATH=$HOME/.local/bin:$PATH
- travis_retry curl -L https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'

in my travis.yaml these fail when I attempt to build on macOS using

jobs:
  include:
  ...
  - name: "LTS 9.6 (Haskell for macOS)"
    os: osx
    osx_image: xcode10
    env: ...
    ...

with

tar: Option --wildcards is not supported
Usage:
  List:    tar -tf <archive-filename>
  Extract: tar -xf <archive-filename>
  Create:  tar -cf <archive-filename> [filenames...]
  Help:    tar --help
curl: (23) Failed writing body (0 != 597)
The command "curl -L https://www.stackage.org/stack/linux-x86_64" failed. Retrying, 2 of 3.
curl: (23) Failed writing body (0 != 597)
The command "curl -L https://www.stackage.org/stack/linux-x86_64" failed. Retrying, 3 of 3.
curl: (23) Failed writing body (0 != 597)
The command "curl -L https://www.stackage.org/stack/linux-x86_64" failed 3 times.

The question I guess is how do I modify my travis.yaml for jobs.include and before_install to install stack for macOS?

You are downloading https://www.stackage.org/stack/linux-x86_64, which seemingly sounds like a Linux executable. I would be pretty surprised if the Mac could execute it.

  1. I wouldn’t use travis_retry here, since curl has the --retry flag that works better.
  2. macOS uses BSD tar , not GNU tar . You can either:
  3. Find a common flag that works on both.
  4. Install gnu-tar , and use that instead. (This formula requires more than just brew install gnu-tar , if you want to execute it as tar , so be sure to set it up correctly.)
1 Like

hey @montana so what do you suggest next?

Maybe grab the macOS version instead of the Linux executable.

curl -sSL https://get.haskellstack.org/ | sh
1 Like

Thank you, this was the fix.

Glad I could resolve this for you.

Imprint