clj-on-windows

For those interested in making clj on Windows https://dev.clojure.org/jira/browse/TDEPS-67. Also see https://github.com/littleli/scoop-clojure.
puzzler 2020-12-17T03:13:12.121800Z

I tried the scoop instructions, and the install appeared to work, but when I restarted powershell, I saw no evidence of the installation, nor could I find a directory in the modules folder associated with scoop.

puzzler 2020-12-17T03:14:08.122400Z

I'm considering Sean's suggestion of WSL2, but figured I'd try the easier install processes first.

2020-12-17T03:59:57.122800Z

fwiw, this is the sort of output i get when installing via scoop:

Installing 'clojure' (1.10.1.754) [64bit]
clojure-tools-1.10.1.754.zip (16.7 MB) [======================================================================] 100%
Checking hash of clojure-tools-1.10.1.754.zip ... ok.
Extracting clojure-tools-1.10.1.754.zip ... done.
Linking ~\scoop\apps\clojure\current => ~\scoop\apps\clojure\1.10.1.754
Creating shim for 'cmd-clojure'.
Creating shim for 'cmd-clj'.
Installing PowerShell module 'ClojureTools'
Linking ~\scoop\modules\ClojureTools => ~\scoop\apps\clojure\current
'clojure' (1.10.1.754) was installed successfully!

2020-12-17T04:00:48.123400Z

when i look in C:\Users\user\scoop\modules\ClojureTools i see some relevant looking bits

2020-12-17T04:03:06.124600Z

restarting powershell (the windows one) gives an environment that allows clj to work it seems -- i wonder what's different

puzzler 2020-12-17T09:07:58.126Z

OK, thanks for the clarification on where scoop puts its modules. Yes, I see that file. clj works provided I change the execution policy, but when I change it back to default and restart power shell, I get that error message again that it can't load the ClojureTools module.

2020-12-17T09:15:50.128300Z

hmm, i don't understand how that works to be of much use, sorry. on a possibly related note, from the traditional non-powershell prompt, does cmd-clj work for you with the execution policy set to the default? (i believe that's a shim prepared by scoop.)

borkdude 2020-12-17T09:17:55.129700Z

@puzzler if you have Windows clojure problems and you are already using scoop, you could try to scoop install babashka and then try:

bb --clojure -M -e (+ 1 2 3)
for example. Babashka now ships with a clojure runner as well which may work better in some circumstances on Windows (e.g. in cmd.exe)

borkdude 2020-12-17T09:18:50.129900Z

Could be useful for debugging

puzzler 2020-12-17T09:40:46.130200Z

cmd-clj : File C:\Users\Mark\scoop\shims\cmd-clj.ps1 cannot be loaded because running scripts is disabled on this
system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ cmd-clj
+ ~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

borkdude 2020-12-17T09:41:43.130700Z

the babashka clojure stuff doesn't use powershell which is a recurring reported problem

borkdude 2020-12-17T09:42:31.130900Z

@puzzler you could try: Set-ExecutionPolicy RemoteSigned

puzzler 2020-12-17T09:48:26.131300Z

I just installed babashka, but I don't know much about it. Does it take similar command line args as clj?

puzzler 2020-12-17T09:48:27.131400Z

Yes, setting the execution policy like you describe definitely works, I just don't understand the implications of leaving it like that, so am reluctant. My hope was to find something where I could set the execution policy just for install, and then put it back to default and still be able to run clj.

puzzler 2020-12-17T09:48:28.131500Z

Do people generally feel like RemoteSigned is safe for leaving on?

borkdude 2020-12-17T09:49:04.132100Z

@puzzler The newest babashka has a --clojure option which then takes the same args as the official clojure CLI. It invokes the same tools.deps.alpha jar.

puzzler 2020-12-17T09:49:25.132300Z

That worked great! Thanks.

littleli 2020-12-17T09:50:08.133Z

@puzzler this is execution policity I currently have:

~ $ Get-ExecutionPolicy -List

        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy       Undefined
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser       Undefined
 LocalMachine    RemoteSigned

borkdude 2020-12-17T09:50:46.133200Z

fyi https://stackoverflow.com/a/4038991/6264

chucklehead 2020-12-17T22:24:51.135400Z

@puzzler it's a common configuration change particularly for anyone who needs to do dev or administrative tasks in PowerShell. There's actually a GUI toggle for it through the Settings app under Settings > Update & Security > For developers > PowerShell, to give you an idea of how regularly people change it.