Unable to Install Daml SDK

I am attempting to install the Daml SDK, but I am having trouble. I managed to successfully run the following command it didn’t have any errors.

curl -sSL https://get.daml.com/ | sh

However, when trying to run daml version, it says that daml command doesn’t exist. Then, I went through the following steps labeled in the screenshot (including opening a new terminal each time), but the daml command is still unable to be used.

Any help is appreciated. I’m running on a Mac (zsh).

On a previous thread, it was suggested to try…

ls -l ~/.daml/bin/daml

… and let us know what you see.

Mine looks like this:

lrwxr-xr-x 1 wallacekelly 22 Apr 23 08:41 /Users/wallacekelly/.daml/bin/daml -> ../sdk/2.8.3/daml/daml

I get the following.

lrwxr-xr-x 1 stevenscarpati staff 22 Apr 22 20:33 /Users/stevenscarpati/.daml/bin/daml → …/sdk/2.8.4/daml/daml

The largest differences that I notice is that the version I have is 2.8.4. Maybe there is something to do with the staff keyword after stevenscarpati, but I frankly have no clue.

STAFF is the Group that normal users are added to on a MacOS by default, nothing more.

Here is the same command output from my system:

# Daml
benm:bash $ ls -l ~/.daml/bin/daml
lrwxr-xr-x@ 1 benm  staff  22 23 Feb 12:08 /Users/benm/.daml/bin/daml -> ../sdk/2.8.3/daml/daml

# Groups
benm:bash $ groups
staff everyone localaccounts _appserverusr _appserveradm com.apple.access_ssh com.apple.sharepoint.group.2 _lpoperator com.apple.sharepoint.group.1

It seems that you have a correct install, so you can do:

$ daml version
$ daml --help

From there, just follow the Getting Started with Daml documentation.

The problem is that I cannot do either of those commands because daml is an unrecognized command as shown below.

I suppose this just means your PATH was not updated correctly.

I have the ./daml/bin/ folder in my path.

> echo "${PATH}" | tr ':' '\n' | grep daml
/Users/wallacekelly/.daml/bin

@CameronScarpati To build up on @WallaceKelly’s message, can you please share the output of this command?

echo "${PATH}" | tr ':' '\n' | grep daml

as well as this command:

cat $HOME/.zprofile | grep 'daml/bin'

Ideally, your session should look something like this:

$ echo "${PATH}" | tr ':' '\n' | grep daml
/Users/stevenscarpati/.daml/bin
$ cat $HOME/.zprofile | grep 'daml/bin'
export PATH="$HOME/.daml/bin:$PATH"
$

If you’re seeing different output, please share what you get instead of the above.

I get the following message in my terminal. I have no idea why I don’t get a message for the first command, but the second command is definitely due to the fact that I’ve put these commands in so many times. I even reinstalled daml using the command listed below.

curl -sSL https://get.daml.com/ | sh

Any help is appreciated. Below is my session after those two commands.

That command not found: compdef line near the top may be the cause of the issue here. A possible hypothesis is that your .zprofile does contain the appropriate entry to add daml to PATH, but does not reach that line because of an earlier failure.

The easiest way to move forward here would be for you to post your entire ~/.zprofile. However, this may be a bad idea. In some situations, passwords and other credentials need to be defined as environment variables, and sometimes they can end up into your ~/.zprofile.

Could you look through your ~/.zprofile very carefully to verify that it does not contain any credentials or passwords, and, assuming it doesn’t, post the entire thing here?

If you don’t know how to access your ~/.zprofile outside of the terminal, you can show the entire file in a terminal by running

$ cat ~/.zprofile

If you’re not comfortable posting you ~/.zprofile, I’d suggest following these steps. First, try running echo $SHELL in your terminal, to make sure you are indeed running zsh. Then, open your ~/.zprofile and add echo Hello! at the top. Open a new terminal and check that you see Hello! at the top, before the first prompt. Then, add echo Bye! at the end of the file. Open a new terminal and verify that you can see both Hello! and Bye! before your prompt.

If you see both, it means the entire file runs to completion, and the issue must be more involved. If you don’t see the Bye! message, try moving the echo Bye! command up in the ~/.zprofile one line at a time, until it appears (saving the file and opening a new terminal each time). When it appears, you know the line you just crossed is the one causing an issue.

If both messages appear right away, then I’d try adding our first command, echo "${PATH}" | tr ':' '\n' | grep daml, at the end of your ~/.zprofile, right before the echo Bye!. If you see nothing in-between Hello! and Bye!, then I’m out of ideas without seeing your ~/.zprofile. If you see the expected /Users/stevenscarpati/.daml/bin in-between the two, it means that ~/.zprofile sets your PATH as expected, but something else resets it afterwards.

If you never see the Hello! message, it means your zsh is somehow not sourcing ~/.zprofile at all and we should set the PATH elsewhere.

In all cases, the output of which zsh and zsh --version could be useful too in debugging this.

1 Like

There is nothing special in my .zprofile. After running the following command I get the following output.

cat ~/.zprofile

I also tried reinstalling zsh using homebrew, but nothing has seemed to get rid of that unknown command compdef.

There is indeed nothing there that should cause an issue. I’m left with the idea that something else must be resetting the PATH afterwards, then.

You can double-check that by running:

$ echo 'echo "${PATH}" | tr ":" "\n" | grep daml' >> ~/.zprofile

Given your current .zprofile, it should print out something like:

/Users/stevenscarpati/.daml/bin
/Users/stevenscarpati/.daml/bin
/Users/stevenscarpati/.daml/bin
/Users/stevenscarpati/.daml/bin
/Users/stevenscarpati/.daml/bin
/Users/stevenscarpati/.daml/bin
/Users/stevenscarpati/.daml/bin
/Users/stevenscarpati/.daml/bin

at the top of the next terminal you open.

One other file that zsh loads, I believe, after ~/.zprofile, is ~/.zshrc. Maybe you have something that resets your path there? (and possibly tries to use compdef)

Can you look at and then, if safe, share the output of

$ cat ~/.zshrc

please?

This is quite interesting indeed. It is seemingly related to angular. Also, you don’t need to say ‘please.’ You’re doing so much to help and I thank you. I will do everything on my side to try and solve this as well.

Ok, so it looks lik it’s brew’s fault? :thinking: They did something weird there, likely some escaping issue.

Do you see this line in your .zshrc?

export PATH=/opt/homebrew/bin:...

The problem with that line is that it sets the PATH to an exact value, ignoring any previous value the PATH may have had.

Usually, PATH updates are meant to keep the previous PATH and add to it, either at the beginning or at the end, so they generally look something like:

export PATH="/some/new/entry:$PATH"

so that the old PATH is preserved (here we add something to the front).

That line was probably meant to be

export PATH="/opt/homebrew/bin:$PATH"

but something went wrong and the current value of PATH at the time of updating the .zshrc file was expanded. Chronologically, that would have happened before you installed Angular, so it may be a while ago.

At some point you’ll probably want to clean up both your .zprofile and your .zshrc, but the shortest path to having things work right now is to do

$ echo 'export PATH="$HOME/.daml/bin:$PATH"' >> ~/.zshrc

Notice the .zshrc instead of .zprofile.

If you want to do said clean-up, first, make a backup of your current files, in case I made a silly typo in the following that will break everything:

$ cp ~/.zshrc ~/Desktop/zshrc_backup
$ cp ~/.zprofile ~/Desktop/zprofile_backup

Then, you can type:

$ open -a TextEdit $HOME/.zshrc

in a Terminal, which will open your ~/.zshrc in the TextEdit graphical application. You can then replace all of its contents with the following:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/stevenscarpati/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2>/dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/stevenscarpati/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/stevenscarpati/opt/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/stevenscarpati/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

export PATH="/opt/homebrew/bin:$PATH"

# possible fix for command not found; compdef
autoload -Uz compinit && compinit

# Load Angular CLI autocompletion
source <(ng completion script)

# old zprofile
export PATH="/Library/Frameworks/Python.framework/Versions/3.11/bin:$PATH"
export JAVA_HOME="$(/usr/libexec/java_home)"
export PATH="$HOME/.daml/bin:$PATH"

Note that, barring me typoing, the file should be unchanged until the <<< conda initialize <<< line.

The compdef: command not found message likely comes from the Angular completion attempt with the line:

source <(ng completion script)

The easiest way to remove the warning is to comment out (or remove) that line. If you want to try to make it work, though, there is a Stack Overflow question about exactly that case, which seems to suggest a fix (which I’ve included above).

Once you’ve copied the above into your ~/.zshrc, it includes everything you currently have in your ~/.zprofile` so you can remove that one with

$ rm ~/.zprofile

Hope that helps.

1 Like

This seems to work. Thanks for all the help!

1 Like