Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble installing through VScode on macOS #2869

Closed
johnwickerson opened this issue Oct 10, 2022 · 6 comments
Closed

Trouble installing through VScode on macOS #2869

johnwickerson opened this issue Oct 10, 2022 · 6 comments
Assignees
Labels
area: new users Getting new users started platform: macOS macOS-specific issues

Comments

@johnwickerson
Copy link

Hi, when I open a .dfy file in VS Code, I get the following error as it tries to install Dafny...

Starting Dafny installation
deleting previous Dafny installation at /Users/jpw48/.vscode/extensions/dafny-lang.ide-vscode-2.8.3/out/resources/3.8.1
Found a non-supported architecture OSX:arm64. Going to install from source.
Installing Dafny from source in /Users/jpw48/.vscode/extensions/dafny-lang.ide-vscode-2.8.3/out/resources/3.8.1/custom/arm64.

Executing: brew install dotnet-sdk
Executing: javac -version
Javac not found. Please install a valid JDK and ensure that the path containing javac is in the PATH environment variable. You can obtain a free open-source JDK 1.8 from here: https://aws.amazon.com/corretto/

The thing is, if I open the Terminal tab in VS Code, and execute javac -version manually, I get

javac 19

So I'm not sure why it's complaining about not being able to find a JDK. Any thoughts? Thanks very much.

By the way, I'm running macOS 12.6 (Monterey) on an Apple M1 Pro.

@johnwickerson
Copy link
Author

Quick update on this: it's happier if I install version 1.8 of the JDK (which is, to be fair, what the error message suggests). But it then gets stuck trying to find the right version of dotnet -- it seems to want version 6.0.0 exactly. Am I doing something wrong? It seems surprisingly complicated to get Dafny running on a vanilla Mac. Is anybody else struggling?

@kjx
Copy link

kjx commented Oct 12, 2022

I had somewhat similar problems which are logged somewhere, I think on the IDE git.
If you use homebrew

  • brew install dafny should get a stable dotnet and dafny.
  • do a standard install of VSCODE.
  • start VSCode, install the dafny plugin,
  • configure the VSCode plugin to use the homebrew dafny. I have
    • Compiler Runtime Path: /opt/homebrew/Cellar/dafny/3.9.0/libexec/Dafny.dll
    • Language Server Runtime Path: /opt/homebrew/Cellar/dafny/3.9.0/libexec/DafnyLanguageServer.dll

@prvshah51
Copy link
Collaborator

prvshah51 commented Oct 12, 2022

Can you try choosing v3.9 from extension setting and let it install it for you ? extension should have done that out of the box but there seems an error in the installation process. I am asking you to install v3.9 because there are some changes for installation dependencies which may help.

@prvshah51 prvshah51 self-assigned this Oct 12, 2022
@prvshah51 prvshah51 added area: new users Getting new users started platform: macOS macOS-specific issues labels Oct 12, 2022
@prvshah51
Copy link
Collaborator

Also, just released v2.8.4 for VSCode extension which will install Dafny v3.9.0 by default.

@kjx
Copy link

kjx commented Oct 12, 2022

so I tried clearing paths to daftly, reinstalling 284, same problem as I had earlier #dafny-lang/ide-vscode/283

the presenting problems may be different but the underlying issue here is not getting arm64 (for either Java or dafny proper) on M* macs...

@johnwickerson
Copy link
Author

Thank you very much @kjx and @prvshah51 for your help. (Sorry for the slow reply; I've been on leave.)

I've now got it working, probably thanks to the updates that have been done by the Dafny team in the meantime. What worked for me was something roughly like this:

  1. Running brew install dotnet (which installed version 6.0.110 of the .NET SDK)
  2. Appending export DOTNET_ROOT="/opt/homebrew/opt/dotnet/libexec" to my ~/.zshrc (as instructed by homebrew)
  3. Uninstalling and reinstalling the Dafny extension in VS Code.

(I ran various other commands like brew install dafny but I'm not sure which ones actually helped!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: new users Getting new users started platform: macOS macOS-specific issues
Projects
None yet
Development

No branches or pull requests

3 participants