# Nonsensical error message from running \`install.sh\` with flags

**URL:** <https://forum.canton.network/t/nonsensical-error-message-from-running-install-sh-with-flags/4027>\
**Category:** App Development\
**Tags:** daml-sdk\
**Created:** [February 28, 2022, 5:33pm UTC](https://forum.canton.network/t/nonsensical-error-message-from-running-install-sh-with-flags/4027 "2022-02-28T17:33:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mesch](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/mesch/32/3248_2.png) [@mesch](https://forum.canton.network/u/mesch)\
**Post date:** [February 28, 2022, 5:33pm UTC](https://forum.canton.network/t/nonsensical-error-message-from-running-install-sh-with-flags/4027/1 "2022-02-28T17:33:30Z")

</div>

I try to install a fresh SDK, but prevent it from modifying the dotfiles outright. So I run:

```haskell
./install.sh --set-path=false --bash-completions=false --zsh-completions=false

```

And this yields the error message:

```haskell
SDK not installed. Cannot run command without SDK.
To proceed, please install the SDK by running:

    daml install latest

```

Running `install.sh` without flags works, but then it also messes with the bash dotfiles.

Observed in DAML SDK 1.18.1 on Linux, `daml-sdk-1.18.1-linux.tar.gz`.

Is there anything wrong with that intention? The `install.sh` script forwards its own arguments to `daml install`, so I assumed it would be alright.

---

<div class="post-metadata">

**Author:** ![Ben\_M](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/ben_m/32/3080_2.png) [@Ben\_M](https://forum.canton.network/u/Ben_M)\
**Post date:** [February 28, 2022, 8:41pm UTC](https://forum.canton.network/t/nonsensical-error-message-from-running-install-sh-with-flags/4027/2 "2022-02-28T20:41:32Z")

</div>

Hi @mesch

There are two, good ways to install Daml on GNU/Linux:

1. A method that installs every package individually, found [here](https://discuss.daml.com/t/overview-installing-daml-vs-code-on-xubuntu-focal-20-04-2-lts/2266), or
2. The [auto\_install](https://docs.daml.com/getting-started/installation.html) method from the Daml Documentation

If you are concerned about Curling a Bash file from the Internet, which is understandable, please review the current Bash script using the drop-down menu below.

> **Current Bash script**
>
> ```haskell
> #!/bin/sh
> 
> # Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
> # SPDX-License-Identifier: Apache-2.0
> 
> #
> # Daml is an open-source privacy-aware smart contract language.
> # This script downloads and installs the SDK on Linux and macOS.
> # This will overwrite any existing installation in ~/.daml
> # For more information please visit https://daml.com/ and https://docs.daml.com/
> #
> 
> #
> # USAGE:
> # get-daml.sh Download and install the latest SDK release.
> # get-daml.sh VERSION Download and install given version of SDK.
> #
> 
> set -eu
> readonly INSTALL_MINSIZE=1000000
> if [-z "${TEMPDIR:-}"]; then
> readonly TMPDIR="$(mktemp -d)"
> else
> readonly TMPDIR=$TEMPDIR
> if [! -d "$TEMPDIR"] ; then
> mkdir $TEMPDIR
> fi
> fi
> 
> # Don't remove user specified temporary directory on cleanup.
> rmTmpDir() {
> if [-z "${TEMPDIR:-}"]; then
> rm -rf $TMPDIR
> else
> echo "You may now remove the Daml installation files from $TEMPDIR"
> fi
> }
> 
> cleanup() {
> echo "$(tput setaf 3)FAILED TO INSTALL!$(tput sgr 0)"
> rmTmpDir
> }
> trap cleanup EXIT
> 
> #
> # Check that the temporary directory has enough space for the installation
> #
> if [-x "$(command -v df)" -a -x "$(command -v awk)"]; then
> if ["$(df $TMPDIR | tail -1 | awk '{print $4}')" -lt "$INSTALL_MINSIZE"]; then
> echo "Not enough disk space available to extract Daml SDK in $TMPDIR."
> echo ""
> echo "You can specify an alternative extraction directory by"
> echo "setting the TEMPDIR environment variable."
> exit 1
> fi
> fi
> 
> #
> # Check if curl and tar are available.
> #
> if [-x "$(command -v curl)"]; then
> MISSING=""
> else
> MISSING="curl"
> fi
> if [-x "$(command -v tar)"]; then
> MISSING="$MISSING"
> elif [-n "$MISSING"]; then
> MISSING="$MISSING, tar"
> else
> MISSING="tar"
> fi
> if [-n "$MISSING"]; then
> echo "Missing tools required for Daml installation: $MISSING"
> exit 1
> fi
> 
> #
> # Determine SDK version
> #
> if [-z "${1:-}"] ; then
> echo "Determining latest SDK version..."
> readonly VERSION="$(curl -sS https://docs.daml.com/latest)"
> if [-z "$VERSION"] ; then
> echo "Failed to determine latest SDK version."
> exit 1
> fi
> echo "Latest SDK version is $VERSION"
> else
> readonly VERSION="$1"
> fi
> 
> #
> # Determine operating system.
> #
> readonly OSNAME="$(uname -s)"
> if ["$OSNAME" = "Linux"] ; then
> OS="linux"
> elif ["$OSNAME" = "Darwin"] ; then
> OS="macos"
> else
> echo "Operating system not supported:"
> echo " OSNAME = $OSNAME"
> exit 1
> fi
> 
> #
> # Download SDK tarball
> #
> readonly TARBALL="daml-sdk-$VERSION-$OS.tar.gz"
> readonly URL="https://github.com/digital-asset/daml/releases/download/v$VERSION/$TARBALL"
> 
> echo "$(tput setaf 3)Downloading SDK $VERSION. This may take a while.$(tput sgr 0)"
> curl -SLf $URL --output $TMPDIR/$TARBALL --progress-bar
> if [! -f $TMPDIR/$TARBALL] ; then
> echo "Failed to download SDK tarball."
> exit 1
> fi
> 
> #
> # Remove existing installation.
> #
> readonly DAML_HOME="$HOME/.daml"
> if [-d $DAML_HOME] ; then
> echo "Removing existing installation: $DAML_HOME"
> chmod -R u+w $DAML_HOME
> rm -rf $DAML_HOME
> fi
> 
> #
> # Remove existing cache.
> #
> readonly DAML_CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/daml"
> if [-d $DAML_CACHE] ; then
> echo "Removing existing cache: $DAML_CACHE"
> rm -rf $DAML_CACHE
> fi
> 
> #
> # Extract and install SDK tarball.
> #
> echo "Extracting SDK release tarball."
> mkdir -p $TMPDIR/sdk
> tar xzf $TMPDIR/$TARBALL -C $TMPDIR/sdk --strip-components 1
> $TMPDIR/sdk/install.sh
> if [! -d $DAML_HOME] ; then
> exit 1
> fi
> 
> #
> # Done.
> #
> trap - EXIT
> echo "$(tput setaf 3)Successfully installed Daml.$(tput sgr 0)"
> rmTmpDir
> 
> ```

Either method works, but Method 2 is fast and the only resulting issue may be the placement of the required $PATH env, in either `~/.bash_profile` or `~/.bashrc`

I prefer settings path variables in ~/.bashrc, however you may not.

---

<div class="post-metadata">

**Author:** ![mesch](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/mesch/32/3248_2.png) [@mesch](https://forum.canton.network/u/mesch)\
**Post date:** [March 1, 2022, 1:27am UTC](https://forum.canton.network/t/nonsensical-error-message-from-running-install-sh-with-flags/4027/3 "2022-03-01T01:27:52Z")

</div>

Thanks a lot for the response.

You mention

```haskell
A method that installs every package individually, found [here](https://discuss.daml.com/t/overview-installing-daml-vs-code-on-xubuntu-focal-20-04-2-lts/2266) .

```

However, the linked post does not contain any actual instructions, just the results of the steps described elsewhere:

```haskell
Refer to the previous Debian Buster tutorial for all the steps.

```

However, that previous tutorial is not linked and I don’t know where to find it. From what you describe, it’s more like what I would like to do, unless of course it also involves the execution of `install.sh` at some point, which I don’t know. Can you point me to it?

Btw. I agree the modifications to the dotfiles are useful. FWIW, there are two motivations on our side to separate the steps of installing the sdk itself from setting up a user’s dotfiles:

1. We do use the SDK in non-interactive contexts, specifically as a hermetic toolchain for bazel, and in a container of a continuous build. In those cases updating dotfiles is pointless, albeit admittedly not harmful, once we have figured out where to direct the modifications to.

2. We install the SDK as part of the setup of a larger development environment, and want to impose some structure for understandability. Specifically, we want to separate the “install” phase, which only moves files into place, from the “setup” phase, which configures those files for use.

---

<div class="post-metadata">

**Author:** ![Ben\_M](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/ben_m/32/3080_2.png) [@Ben\_M](https://forum.canton.network/u/Ben_M)\
**Post date:** [March 1, 2022, 1:37am UTC](https://forum.canton.network/t/nonsensical-error-message-from-running-install-sh-with-flags/4027/4 "2022-03-01T01:37:07Z")

</div>

Sorry, I assumed prior knowledge.

The tutorials [Daml on Debian](https://discuss.daml.com/t/complete-walk-through-installing-daml-vs-code-on-debian-buster-10/2226) and [Daml on Ubuntu](https://discuss.daml.com/t/overview-installing-daml-vs-code-on-xubuntu-focal-20-04-2-lts/2266) may be found in the forum [Tutorial](https://discuss.daml.com/c/tutorials-and-guides/11) section.

The versions listed in the Debian tutorial will be a few out as that document was written halfway through last year, and even though it is titled `Debian`, as you know most of the commands and packages will be easily interchangeable.

Your needs re “Install and Setup” are a good point. The basic install that Daml actions on Linux using most methods, is quite benign & friendly, as it uses the $USERs directory as the default location.

Personally I create another directory titled `~/opt/` and extract/install the Daml SDK into there, totally away from everything else. That way if I misconfigure or misuse, it is easy to delete with zero issues.

I hope this helps.

---

<div class="post-metadata">

**Author:** ![mesch](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/mesch/32/3248_2.png) [@mesch](https://forum.canton.network/u/mesch)\
**Post date:** [March 2, 2022, 3:49am UTC](https://forum.canton.network/t/nonsensical-error-message-from-running-install-sh-with-flags/4027/5 "2022-03-02T03:49:33Z")

</div>

Alright, for the record, this is what I do now to prevent `install.sh` from touching dotfiles:

```haskell
# working dir is where the daml-sdk tarball was unpacked
declare -r DAML_HOME=${HOME}/.daml
declare -r HOME_TMP=$(mktemp -d)
mkdir -p $DAML_HOME
mkdir -p $HOME/.cache
ln -s $DAML_HOME $HOME_TMP
ln -s $HOME/.cache $HOME_TMP
HOME=$HOME_TMP "./sdk-${DAML_SDK_VERSION}/install.sh"
rm -rf $HOME_TMP

```

Cheers,  
mesch.

---

<div class="post-metadata">

**Author:** ![Ben\_M](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/ben_m/32/3080_2.png) [@Ben\_M](https://forum.canton.network/u/Ben_M)\
**Post date:** [March 2, 2022, 4:12am UTC](https://forum.canton.network/t/nonsensical-error-message-from-running-install-sh-with-flags/4027/6 "2022-03-02T04:12:26Z")

</div>

Nice solution. Mind if I use that?

---

<div class="post-metadata">

**Author:** ![mesch](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/mesch/32/3248_2.png) [@mesch](https://forum.canton.network/u/mesch)\
**Post date:** [March 2, 2022, 4:14am UTC](https://forum.canton.network/t/nonsensical-error-message-from-running-install-sh-with-flags/4027/7 "2022-03-02T04:14:13Z")

</div>

Please use, I’m glad if it’s useful.

Cheers,  
mesch.

---

<div class="post-metadata">

**Author:** ![Ben\_M](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/ben_m/32/3080_2.png) [@Ben\_M](https://forum.canton.network/u/Ben_M)\
**Post date:** [March 2, 2022, 4:28am UTC](https://forum.canton.network/t/nonsensical-error-message-from-running-install-sh-with-flags/4027/8 "2022-03-02T04:28:03Z")

</div>

As a way to help the community, if you ask a question and it gets solved to your personal or functional satisfaction, either by yourself or someone else, if you can mark the best answer as a solution, that would be great.

To do that, select the Three Dots `...` at the bottom of each post, choose `Solution`.

Thanks again for your question, that was interesting 👍🏻
